本文整理汇总了Java中org.hibernate.cache.spi.access.CollectionRegionAccessStrategy类的典型用法代码示例。如果您正苦于以下问题:Java CollectionRegionAccessStrategy类的具体用法?Java CollectionRegionAccessStrategy怎么用?Java CollectionRegionAccessStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollectionRegionAccessStrategy类属于org.hibernate.cache.spi.access包,在下文中一共展示了CollectionRegionAccessStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
if (AccessType.READ_ONLY.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new ReadOnlyAccessDelegate<HazelcastCollectionRegion>(this, props));
}
if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new NonStrictReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
}
if (AccessType.READ_WRITE.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new ReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
}
throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast.");
}
示例2: buildPluralAttribute
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public OrmAttribute buildPluralAttribute(
PersisterCreationContext creationContext,
Collection collectionBinding,
OrmNavigableSource source,
String propertyName) {
// todo : resolve cache access
final CollectionRegionAccessStrategy cachingAccess = null;
// need PersisterCreationContext - we should always have access to that when building persisters, through finalized initialization
final CollectionPersister collectionPersister = creationContext.getPersisterFactory().createCollectionPersister(
collectionBinding,
(ManagedTypeImplementor) source,
propertyName,
cachingAccess,
creationContext
);
creationContext.registerCollectionPersister( collectionPersister );
return collectionPersister;
}
示例3: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public CollectionRegionAccessStrategy 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 ReadOnlyMemcachedCollectionRegionAccessStrategy(this, settings);
case READ_WRITE:
return new ReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
case NONSTRICT_READ_WRITE:
return new NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
case TRANSACTIONAL:
return new TransactionalMemcachedCollectionRegionAccessStrategy(this, settings);
default:
throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
}
}
示例4: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
public CollectionRegionAccessStrategy 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 ReadOnlyCollectionRegionAccessStrategy( this );
case READ_WRITE:
return new ReadWriteCollectionRegionAccessStrategy( this );
case NONSTRICT_READ_WRITE:
return new NonstrictReadWriteCollectionRegionAccessStrategy( this );
case TRANSACTIONAL:
return new TransactionalCollectionRegionAccessStrategy( this );
// throw new UnsupportedOperationException( "doesn't support this access strategy" );
default:
throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
}
}
示例5: createCollectionPersister
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
@SuppressWarnings( {"unchecked"})
public CollectionPersister createCollectionPersister(
Configuration cfg,
Collection collectionMetadata,
CollectionRegionAccessStrategy cacheAccessStrategy,
SessionFactoryImplementor factory) throws HibernateException {
Class<? extends CollectionPersister> persisterClass = collectionMetadata.getCollectionPersisterClass();
if ( persisterClass == null ) {
persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getCollectionPersisterClass( collectionMetadata );
}
return create( persisterClass, COLLECTION_PERSISTER_CONSTRUCTOR_ARGS, cfg, collectionMetadata, cacheAccessStrategy, factory );
}
示例6: BasicCollectionPersister
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public BasicCollectionPersister(
Collection collection,
CollectionRegionAccessStrategy cacheAccessStrategy,
Configuration cfg,
SessionFactoryImplementor factory) throws MappingException, CacheException {
super( collection, cacheAccessStrategy, cfg, factory );
}
示例7: OneToManyPersister
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public OneToManyPersister(
Collection collection,
CollectionRegionAccessStrategy cacheAccessStrategy,
Configuration cfg,
SessionFactoryImplementor factory) throws MappingException, CacheException {
super( collection, cacheAccessStrategy, cfg, factory );
cascadeDeleteEnabled = collection.getKey().isCascadeDeleteEnabled() &&
factory.getDialect().supportsCascadeDelete();
keyIsNullable = collection.getKey().isNullable();
keyIsUpdateable = collection.getKey().isUpdateable();
}
示例8: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public CollectionRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
if (AccessType.READ_ONLY.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new ReadOnlyAccessDelegate<HazelcastCollectionRegion>(this, props));
}
if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new NonStrictReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
}
if (AccessType.READ_WRITE.equals(accessType)) {
return new CollectionRegionAccessStrategyAdapter(
new ReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
}
throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast.");
}
示例9: buildCollectionRegionAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public static CollectionRegionAccessStrategy buildCollectionRegionAccessStrategy(TayzGridCollectionRegion region, AccessType accessType) {
switch (accessType) {
case READ_ONLY:
return new ReadOnlyTayzGridCollectionRegionAccessStrategy(region);
case NONSTRICT_READ_WRITE:
return new NonStrictReadWriteTayzGridCollectionRegionAccessStrategy(region);
case READ_WRITE:
return new ReadWriteTayzGridCollectionRegionAccessStrategy(region);
case TRANSACTIONAL:
throw new IllegalArgumentException(accessType + " access strategy not supported.");
default:
throw new IllegalArgumentException(accessType + " is not recognized as valid access type.");
}
}
示例10: createCollectionPersister
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
@SuppressWarnings( {"unchecked"})
public CollectionPersister createCollectionPersister(
Collection collectionBinding,
ManagedTypeImplementor source,
String propertyName,
CollectionRegionAccessStrategy cacheAccessStrategy,
PersisterCreationContext creationContext) throws HibernateException {
// // If the metadata for the collection specified an explicit persister class, use it
// Class<? extends CollectionPersister> persisterClass = collectionBinding.getCollectionPersisterClass();
// if ( persisterClass == null ) {
// // Otherwise, use the persister class indicated by the PersisterClassResolver service
// persisterClass = serviceRegistry.getService( PersisterClassResolver.class )
// .getCollectionPersisterClass( collectionBinding );
// }
// return createCollectionPersister( persisterClass, collectionBinding, source, propertyName, cacheAccessStrategy, creationContext );
// todo : ^^ we need to make this fit the published ctor contract (as much as possible)
// for now just create a simpl testing stub
return new CollectionPersisterImpl(
collectionBinding,
source,
propertyName,
null,
creationContext
);
}
示例11: CollectionPersisterImpl
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public CollectionPersisterImpl(
Collection collectionBinding,
ManagedTypeImplementor source,
String localName,
CollectionRegionAccessStrategy collectionCaching,
PersisterCreationContext creationContext) {
super( source, localName, PropertyAccess.DUMMY );
this.source = source;
this.localName = localName;
this.role = source.getNavigableName() + '.' + this.localName;
this.collectionClassification = PersisterHelper.interpretCollectionClassification( collectionBinding );
this.foreignKeyDescriptor = new CollectionKey( this );
this.typeConfiguration = creationContext.getTypeConfiguration();
this.collectionType = new CollectionTypeImpl(
role,
resolveCollectionJtd( creationContext, collectionClassification ),
null,
null
);
if ( collectionBinding instanceof IndexedCollection ) {
final Value indexValueMapping = ( (IndexedCollection) collectionBinding ).getIndex();
if ( indexValueMapping instanceof SimpleValue ) {
final SimpleValue simpleIndexValueMapping = (SimpleValue) indexValueMapping;
// indexAttributeConverter = simpleIndexValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
}
}
final Value elementValueMapping = collectionBinding.getElement();
if ( elementValueMapping instanceof SimpleValue ) {
final SimpleValue simpleElementValueMapping = (SimpleValue) elementValueMapping;
// elementAttributeConverter = simpleElementValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
}
}
示例12: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
if(AccessType.READ_ONLY.equals(accessType)) {
return new ReadOnlyMemcachedCollectionRegionAccessStrategy(this, settings);
} else if(AccessType.READ_WRITE.equals(accessType)) {
return new ReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
} else if(AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
return new NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
} else if(AccessType.TRANSACTIONAL.equals(accessType)) {
throw new CacheException("Transactional access is not supported by Memcached region factory");
} else {
throw new UnsupportedOperationException("Uknown access strategy type - " + accessType);
}
}
示例13: buildAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
switch (accessType) {
case READ_ONLY:
return new ReadOnlyCollectionRegionAccessStrategy(this);
case NONSTRICT_READ_WRITE:
return new NonstrictReadWriteCollectionRegionAccessStrategy(this);
default:
throw new CacheException("Unsupported access strategy : " + accessType + ".");
}
}
示例14: getCacheAccessStrategy
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
@Override
public CollectionRegionAccessStrategy getCacheAccessStrategy() {
return cacheAccessStrategy;
}
示例15: CollectionCleanup
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; //导入依赖的package包/类
private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess) {
this.cacheAccess = cacheAccess;
this.cacheLock = cacheAccess.lockRegion();
cacheAccess.removeAll();
}