Java Code Examples for org.hibernate.cache.spi.access.AccessType#fromExternalName()

The following examples show how to use org.hibernate.cache.spi.access.AccessType#fromExternalName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InFlightMetadataCollectorImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addEntityBinding(PersistentClass persistentClass) throws DuplicateMappingException {
	final String entityName = persistentClass.getEntityName();
	if ( entityBindingMap.containsKey( entityName ) ) {
		throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, entityName );
	}
	entityBindingMap.put( entityName, persistentClass );

	final AccessType accessType = AccessType.fromExternalName( persistentClass.getCacheConcurrencyStrategy() );
	if ( accessType != null ) {
		if ( persistentClass.isCached() ) {
			locateCacheRegionConfigBuilder( persistentClass.getRootClass().getCacheRegionName() ).addEntityConfig(
					persistentClass,
					accessType
			);
		}

		if ( persistentClass.hasNaturalId() && persistentClass instanceof RootClass && persistentClass.getNaturalIdCacheRegionName() != null ) {
			locateCacheRegionConfigBuilder( persistentClass.getNaturalIdCacheRegionName() ).addNaturalIdConfig(
					(RootClass) persistentClass,
					accessType
			);
		}
	}
}
 
Example 2
Source File: InFlightMetadataCollectorImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCollectionBinding(Collection collection) throws DuplicateMappingException {
	final String collectionRole = collection.getRole();
	if ( collectionBindingMap.containsKey( collectionRole ) ) {
		throw new DuplicateMappingException( DuplicateMappingException.Type.COLLECTION, collectionRole );
	}
	collectionBindingMap.put( collectionRole, collection );

	final AccessType accessType = AccessType.fromExternalName( collection.getCacheConcurrencyStrategy() );
	if ( accessType != null ) {
		locateCacheRegionConfigBuilder( collection.getCacheRegionName() ).addCollectionConfig(
				collection,
				accessType
		);
	}
}
 
Example 3
Source File: Caching.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void overlay(CacheRegionDefinition overrides) {
	if ( overrides == null ) {
		return;
	}

	requested = TruthValue.TRUE;
	accessType = AccessType.fromExternalName( overrides.getUsage() );
	if ( StringHelper.isEmpty( overrides.getRegion() ) ) {
		region = overrides.getRegion();
	}
	// ugh, primitive boolean
	cacheLazyProperties = overrides.isCacheLazy();
}
 
Example 4
Source File: CachingRegionFactory.java    From hibernate4-memcached with Apache License 2.0 5 votes vote down vote up
@Override
public AccessType getDefaultAccessType() {
	if (properties != null && properties.get(DEFAULT_ACCESSTYPE) != null) {
		return AccessType.fromExternalName(properties.getProperty(DEFAULT_ACCESSTYPE));
	}
	return AccessType.READ_WRITE;
}
 
Example 5
Source File: CacheAccessTypeConverter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public static AccessType fromXml(String name) {
	return AccessType.fromExternalName( name );
}