( ( RootClass) entityBinding ).setCacheConcurrencyStrategy( getCacheConcurrencyStrategy() ); entityBinding.setCached( true );
rootEntityDescriptor.setCacheConcurrencyStrategy( caching.getAccessType().getExternalName() ); rootEntityDescriptor.setCacheConcurrencyStrategy( mappingDocument.getBuildingOptions().getImplicitCacheAccessType().getExternalName() );
final PersistentClass customerMapping = metadata.getEntityBinding( Customer.class.getName() ); customerMapping.setCached( true ); ((RootClass) customerMapping ).setCacheConcurrencyStrategy( "read-write");
( (RootClass) entityBinding ).setCacheConcurrencyStrategy( cacheRegionDefinition.getUsage() ); ( (RootClass) entityBinding ).setLazyPropertiesCacheable( cacheRegionDefinition.isCacheLazy() );
final PersistentClass customerMapping = metadata.getEntityBinding( Customer.class.getName() ); customerMapping.setCached( true ); ( (RootClass) customerMapping ).setCacheConcurrencyStrategy( "read-write" );
rootClass.setCacheConcurrencyStrategy( cacheConcurrentStrategy ); rootClass.setCacheRegionName( cacheRegion ); rootClass.setLazyPropertiesCacheable( cacheLazyProperty );
if ( StringHelper.isNotEmpty( where ) ) rootClass.setWhere( where ); if ( cacheConcurrentStrategy != null ) { rootClass.setCacheConcurrencyStrategy( cacheConcurrentStrategy ); rootClass.setCacheRegionName( cacheRegion ); rootClass.setLazyPropertiesCacheable( cacheLazyProperty );
void setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region) throws MappingException { RootClass rootClass = getRootClassMapping( clazz ); if (rootClass == null) throw new MappingException("Cannot cache an unknown entity: " + clazz); rootClass.setCacheConcurrencyStrategy( concurrencyStrategy ); rootClass.setCacheRegionName( region ); }
private void applyCacheConcurrencyStrategy(CacheHolder holder) { RootClass rootClass = getRootClassMapping( holder.role ); if ( rootClass == null ) { throw new MappingException( "Cannot cache an unknown entity: " + holder.role ); } rootClass.setCacheConcurrencyStrategy( holder.usage ); rootClass.setCacheRegionName( holder.region ); rootClass.setLazyPropertiesCacheable( holder.cacheLazy ); }
private void applyCacheConcurrencyStrategy(CacheHolder holder) { RootClass rootClass = getRootClassMapping( holder.role ); if ( rootClass == null ) { throw new MappingException( "Cannot cache an unknown entity: " + holder.role ); } rootClass.setCacheConcurrencyStrategy( holder.usage ); rootClass.setCacheRegionName( holder.region ); rootClass.setLazyPropertiesCacheable( holder.cacheLazy ); }
entity.setCacheConcurrencyStrategy( subnode.attributeValue( "usage" ) ); entity.setCacheRegionName( subnode.attributeValue( "region" ) ); entity.setLazyPropertiesCacheable( !"non-lazy".equals( subnode.attributeValue( "include" ) ) );
entity.setCacheConcurrencyStrategy( subnode.attributeValue( "usage" ) ); entity.setCacheRegionName( subnode.attributeValue( "region" ) );
rootEntityDescriptor.setCacheConcurrencyStrategy( caching.getAccessType().getExternalName() ); rootEntityDescriptor.setCacheConcurrencyStrategy( mappingDocument.getBuildingOptions().getImplicitCacheAccessType().getExternalName() );
private static Metadata buildMetadata(StandardServiceRegistry registry) { final String cacheStrategy = "transactional"; MetadataSources metadataSources = new MetadataSources( registry ); for ( Class entityClass : getAnnotatedClasses() ) { metadataSources.addAnnotatedClass( entityClass ); } Metadata metadata = metadataSources.buildMetadata(); for ( PersistentClass entityBinding : metadata.getEntityBindings() ) { if (!entityBinding.isInherited()) { ( (RootClass) entityBinding ).setCacheConcurrencyStrategy( cacheStrategy); } } for ( Collection collectionBinding : metadata.getCollectionBindings() ) { collectionBinding.setCacheConcurrencyStrategy( cacheStrategy ); } return metadata; }
( (RootClass) entityBinding ).setCacheConcurrencyStrategy( cacheRegionDefinition.getUsage() ); ( (RootClass) entityBinding ).setLazyPropertiesCacheable( cacheRegionDefinition.isCacheLazy() );
private Metadata buildMetadata(StandardServiceRegistry registry) { MetadataSources metadataSources = new MetadataSources( registry ); for ( Class entityClass : getAnnotatedClasses() ) { metadataSources.addAnnotatedClass( entityClass ); } Metadata metadata = metadataSources.buildMetadata(); for ( PersistentClass entityBinding : metadata.getEntityBindings() ) { if (!entityBinding.isInherited()) { ( (RootClass) entityBinding ).setCacheConcurrencyStrategy( accessType.getExternalName() ); } } // Collections don't have integrated version, these piggyback on parent's owner version (for DB). // However, this version number isn't extractable and is not passed to cache methods. AccessType collectionAccessType = accessType == AccessType.NONSTRICT_READ_WRITE ? AccessType.READ_WRITE : accessType; for ( Collection collectionBinding : metadata.getCollectionBindings() ) { collectionBinding.setCacheConcurrencyStrategy( collectionAccessType.getExternalName() ); } return metadata; }
CacheConfig cc = m.getCache(); if (cc != null && cc.getEnabled()) { root.setCacheConcurrencyStrategy(cc.getUsage()); if ("read-only".equals(cc.getUsage())) { root.setMutable(false);
CacheConfig cc = m.getCache(); if (cc != null && cc.getEnabled()) { root.setCacheConcurrencyStrategy(cc.getUsage()); if ("read-only".equals(cc.getUsage())) { root.setMutable(false);
if ( entityBinding instanceof RootClass ) { RootClass rootClass = (RootClass) entityBinding; rootClass.setCacheConcurrencyStrategy( "transactional" ); rootClass.setCachingExplicitlyRequested(true);
for ( PersistentClass entityBinding : metadata.getEntityBindings() ) { if ( entityBinding instanceof RootClass ) { ( (RootClass) entityBinding ).setCacheConcurrencyStrategy( "transactional" );