当前位置: 首页>>代码示例>>Java>>正文


Java NaturalIdRegionAccessStrategy类代码示例

本文整理汇总了Java中org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy的典型用法代码示例。如果您正苦于以下问题:Java NaturalIdRegionAccessStrategy类的具体用法?Java NaturalIdRegionAccessStrategy怎么用?Java NaturalIdRegionAccessStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NaturalIdRegionAccessStrategy类属于org.hibernate.cache.spi.access包,在下文中一共展示了NaturalIdRegionAccessStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: UnionSubclassEntityPersister

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public UnionSubclassEntityPersister(
		final EntityBinding entityBinding,
		final EntityRegionAccessStrategy cacheAccessStrategy,
		final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		final SessionFactoryImplementor factory,
		final Mapping mapping) throws HibernateException {
	super(entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
	// TODO: implement!!! initializing final fields to null to make compiler happy.
	subquery = null;
	tableName = null;
	subclassClosure = null;
	spaces = null;
	subclassSpaces = null;
	discriminatorValue = null;
	discriminatorSQLValue = null;
	constraintOrderedTableNames = null;
	constraintOrderedKeyColumnNames = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:UnionSubclassEntityPersister.java

示例2: buildAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
@Override
public NaturalIdRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast.");
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:17,代码来源:HazelcastNaturalIdRegion.java

示例3: populateMappingModel

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
private static void populateMappingModel(MetadataImplementor mappingMetadata, ExplicitSqmDomainMetamodel domainMetamodel) {
//		final PersisterFactory persisterFactory = getSessionFactory().getServiceRegistry().getService( PersisterFactory.class );
		final PersisterFactory persisterFactory = domainMetamodel.getPersisterFactory();

		for ( final PersistentClass model : mappingMetadata.getEntityBindings() ) {
//			final EntityRegionAccessStrategy accessStrategy = getSessionFactory().getCache().determineEntityRegionAccessStrategy(
//					model
//			);
			final EntityRegionAccessStrategy accessStrategy = null;

//			final NaturalIdRegionAccessStrategy naturalIdAccessStrategy = getSessionFactory().getCache().determineNaturalIdRegionAccessStrategy(
//					model
//			);
			final NaturalIdRegionAccessStrategy naturalIdAccessStrategy = null;

			persisterFactory.createEntityPersister(
					model,
					accessStrategy,
					naturalIdAccessStrategy,
					domainMetamodel
			);
		}

		persisterFactory.finishUp( domainMetamodel );
	}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:26,代码来源:OrmHelper.java

示例4: buildAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {

        switch (accessType) {

            case READ_ONLY:
                if (metadata.isMutable()) {
                    log.warn("read-only cache configured for mutable entity ["
                            + getName() + "]");
                }
                return new ReadOnlyMemcachedNaturalIdRegionAccessStrategy(this, settings);
            case READ_WRITE:
                return new ReadWriteMemcachedNaturalIdRegionAccessStrategy(this, settings, metadata);
            case NONSTRICT_READ_WRITE:
                return new NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy(this, settings);
            case TRANSACTIONAL:
                return new TransactionalMemcachedNaturalIdRegionAccessStrategy(this, settings);
            default:
                throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
        }
    }
 
开发者ID:mihaicostin,项目名称:hibernate-l2-memcached,代码行数:21,代码来源:MemcachedNaturalIdRegion.java

示例5: buildAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
@Override
	public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
		switch ( accessType ) {
			case READ_ONLY:
				if ( getCacheDataDescription().isMutable() ) {
					LOG.warnf( "read-only cache configured for mutable collection [ %s ]", getName() );
				}
				return new ReadOnlyNaturalIdRegionAccessStrategy( this );
			case READ_WRITE:
				 return new ReadWriteNaturalIdRegionAccessStrategy( this );
			case NONSTRICT_READ_WRITE:
				return new NonstrictReadWriteNaturalIdRegionAccessStrategy( this );
			case TRANSACTIONAL:
				return new TransactionalNaturalIdRegionAccessStrategy( this );
//				throw new UnsupportedOperationException( "doesn't support this access strategy" );
			default:
				throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
		}
	}
 
开发者ID:kwon37xi,项目名称:hibernate4-memcached,代码行数:20,代码来源:NaturalIdRegionImpl.java

示例6: createEntityPersister

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
@Override
@SuppressWarnings( {"unchecked"})
public EntityPersister createEntityPersister(
		PersistentClass metadata,
		EntityRegionAccessStrategy cacheAccessStrategy,
		NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		SessionFactoryImplementor factory,
		Mapping cfg) {
	Class<? extends EntityPersister> persisterClass = metadata.getEntityPersisterClass();
	if ( persisterClass == null ) {
		persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getEntityPersisterClass( metadata );
	}
	return create( persisterClass, ENTITY_PERSISTER_CONSTRUCTOR_ARGS, metadata, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory, cfg );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:PersisterFactoryImpl.java

示例7: removeNaturalIdCrossReference

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
/**
 * Handle removing cross reference entries for the given natural-id/pk combo
 *
 * @param persister The persister representing the entity type.
 * @param pk The primary key value
 * @param naturalIdValues The natural id value(s)
 * 
 * @return The cached values, if any.  May be different from incoming values.
 */
public Object[] removeNaturalIdCrossReference(EntityPersister persister, Serializable pk, Object[] naturalIdValues) {
	persister = locatePersisterForKey( persister );
	validateNaturalId( persister, naturalIdValues );

	final NaturalIdResolutionCache entityNaturalIdResolutionCache = naturalIdResolutionCacheMap.get( persister );
	Object[] sessionCachedNaturalIdValues = null;
	if ( entityNaturalIdResolutionCache != null ) {
		final CachedNaturalId cachedNaturalId = entityNaturalIdResolutionCache.pkToNaturalIdMap
				.remove( pk );
		if ( cachedNaturalId != null ) {
			entityNaturalIdResolutionCache.naturalIdToPkMap.remove( cachedNaturalId );
			sessionCachedNaturalIdValues = cachedNaturalId.getValues();
		}
	}

	if ( persister.hasNaturalIdCache() ) {
		final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister
				.getNaturalIdCacheAccessStrategy();
		final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session() );
		naturalIdCacheAccessStrategy.evict( naturalIdCacheKey );

		if ( sessionCachedNaturalIdValues != null
				&& !Arrays.equals( sessionCachedNaturalIdValues, naturalIdValues ) ) {
			final NaturalIdCacheKey sessionNaturalIdCacheKey = new NaturalIdCacheKey( sessionCachedNaturalIdValues, persister, session() );
			naturalIdCacheAccessStrategy.evict( sessionNaturalIdCacheKey );
		}
	}

	return sessionCachedNaturalIdValues;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:NaturalIdXrefDelegate.java

示例8: removeSharedNaturalIdCrossReference

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
@Override
		public void removeSharedNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] naturalIdValues) {
			if ( !persister.hasNaturalIdentifier() ) {
				// nothing to do
				return;
			}

			if ( ! persister.hasNaturalIdCache() ) {
				// nothing to do
				return;
			}

			// todo : couple of things wrong here:
			//		1) should be using access strategy, not plain evict..
			//		2) should prefer session-cached values if any (requires interaction from removeLocalNaturalIdCrossReference

			persister = locateProperPersister( persister );
			final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister.getNaturalIdCacheAccessStrategy();
			final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session );
			naturalIdCacheAccessStrategy.evict( naturalIdCacheKey );

//			if ( sessionCachedNaturalIdValues != null
//					&& !Arrays.equals( sessionCachedNaturalIdValues, deletedNaturalIdValues ) ) {
//				final NaturalIdCacheKey sessionNaturalIdCacheKey = new NaturalIdCacheKey( sessionCachedNaturalIdValues, persister, session );
//				naturalIdCacheAccessStrategy.evict( sessionNaturalIdCacheKey );
//			}
		}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:StatefulPersistenceContext.java

示例9: loadFromDatasource

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
/**
 * Performs the process of loading an entity from the configured
 * underlying datasource.
 * 
 * @param event The load event
 *
 * @return The object loaded from the datasource, or null if not found.
 */
protected Serializable loadFromDatasource(final ResolveNaturalIdEvent event) {
	final SessionFactoryImplementor factory = event.getSession().getFactory();
	final boolean stats = factory.getStatistics().isStatisticsEnabled();
	long startTime = 0;
	if ( stats ) {
		startTime = System.nanoTime();
	}
	
	final Serializable pk = event.getEntityPersister().loadEntityIdByNaturalId(
			event.getOrderedNaturalIdValues(),
			event.getLockOptions(),
			event.getSession()
	);
	
	if ( stats ) {
		final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = event.getEntityPersister().getNaturalIdCacheAccessStrategy();
		final String regionName = naturalIdCacheAccessStrategy == null ? null : naturalIdCacheAccessStrategy.getRegion().getName();
		final long endTime = System.nanoTime();
		final long milliseconds = TimeUnit.MILLISECONDS.convert( endTime - startTime, TimeUnit.NANOSECONDS );
		factory.getStatisticsImplementor().naturalIdQueryExecuted(
				regionName,
				milliseconds );
	}
	
	//PK can be null if the entity doesn't exist
	if (pk != null) {
		event.getSession().getPersistenceContext().getNaturalIdHelper().cacheNaturalIdCrossReferenceFromLoad(
				event.getEntityPersister(),
				pk,
				event.getOrderedNaturalIdValues()
		);
	}
	
	return pk;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:DefaultResolveNaturalIdEventListener.java

示例10: buildAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public NaturalIdRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast.");
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:16,代码来源:HazelcastNaturalIdRegion.java

示例11: buildNaturalIdRegionAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public static NaturalIdRegionAccessStrategy buildNaturalIdRegionAccessStrategy(TayzGridNaturalIdRegion region, AccessType accessType) {
    switch (accessType) {
        case READ_ONLY:
            return new ReadOnlyTayzGridNaturalIdRegionAccessStrategy(region);
        case NONSTRICT_READ_WRITE:
            return  new NonStrictReadWriteTayzGridNaturalIdRegionAccessStrategy(region);
        case READ_WRITE:
            return new ReadWriteTayzGridNaturalIdRegionAccessStraegy(region);
        case TRANSACTIONAL:
            throw new IllegalArgumentException(accessType + " access strategy not supported.");
        default:
            throw new IllegalArgumentException(accessType + " is not recognized as valid access type.");
    }
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:15,代码来源:TayzGridStrategyBuilder.java

示例12: EntityPersisterImpl

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public EntityPersisterImpl(
		PersistentClass mappingDescriptor,
		EntityRegionAccessStrategy entityCaching,
		NaturalIdRegionAccessStrategy naturalIdCaching,
		PersisterCreationContext creationContext) {
	super( resolveEntityJavaTypeDescriptor( creationContext, mappingDescriptor), null, null );
	this.entityName = mappingDescriptor.getEntityName();
	this.jpaEntityName = mappingDescriptor.getJpaEntityName();

	setTypeConfiguration( creationContext.getTypeConfiguration() );
}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:12,代码来源:EntityPersisterImpl.java

示例13: buildAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
@Override
public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    switch (accessType) {
        case READ_ONLY:
            return new ReadOnlyNaturalIdRegionAccessStrategy(this);
        case NONSTRICT_READ_WRITE:
            return new NonstrictReadWriteNaturalIdRegionAccessStrategy(this);
        default:
            throw new CacheException("Unsupported access strategy : " + accessType + ".");
    }
}
 
开发者ID:kwon37xi,项目名称:hibernate4-memcached,代码行数:12,代码来源:NaturalIdMemcachedRegion.java

示例14: getNaturalIdCacheAccessStrategy

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public NaturalIdRegionAccessStrategy getNaturalIdCacheAccessStrategy() {
	return naturalIdRegionAccessStrategy;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:AbstractEntityPersister.java

示例15: JoinedSubclassEntityPersister

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入依赖的package包/类
public JoinedSubclassEntityPersister(
		final EntityBinding entityBinding,
		final EntityRegionAccessStrategy cacheAccessStrategy,
		final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		final SessionFactoryImplementor factory,
		final Mapping mapping) throws HibernateException {
	super( entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
	// TODO: implement!!! initializing final fields to null to make compiler happy
	tableSpan = -1;
	tableNames = null;
	naturalOrderTableNames = null;
	tableKeyColumns = null;
	tableKeyColumnReaders = null;
	tableKeyColumnReaderTemplates = null;
	naturalOrderTableKeyColumns = null;
	naturalOrderTableKeyColumnReaders = null;
	naturalOrderTableKeyColumnReaderTemplates = null;
	naturalOrderCascadeDeleteEnabled = null;
	spaces = null;
	subclassClosure = null;
	subclassTableNameClosure = null;
	subclassTableKeyColumnClosure = null;
	isClassOrSuperclassTable = null;
	naturalOrderPropertyTableNumbers = null;
	propertyTableNumbers = null;
	subclassPropertyTableNumberClosure = null;
	subclassColumnTableNumberClosure = null;
	subclassFormulaTableNumberClosure = null;
	subclassTableSequentialSelect = null;
	subclassTableIsLazyClosure = null;
	discriminatorValues = null;
	notNullColumnNames = null;
	notNullColumnTableNumbers = null;
	constraintOrderedTableNames = null;
	constraintOrderedKeyColumnNames = null;
	discriminatorValue = null;
	discriminatorSQLString = null;
	discriminatorType = StandardBasicTypes.INTEGER;
	explicitDiscriminatorColumnName = null;
	discriminatorAlias = IMPLICIT_DISCRIMINATOR_ALIAS;
	coreTableSpan = -1;
	isNullableTable = null;
	subclassNamesBySubclassTable = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:JoinedSubclassEntityPersister.java


注:本文中的org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。