Java Code Examples for org.hibernate.mapping.PersistentClass#isCached()

The following examples show how to use org.hibernate.mapping.PersistentClass#isCached() . These examples are extracted from open source projects. 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
@SuppressWarnings("unchecked")
private boolean determineCanReadFromCache(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy) {
	if ( cacheAccessStrategy == null ) {
		return false;
	}

	if ( persistentClass.isCached() ) {
		return true;
	}

	final Iterator<Subclass> subclassIterator = persistentClass.getSubclassIterator();
	while ( subclassIterator.hasNext() ) {
		final Subclass subclass = subclassIterator.next();
		if ( subclass.isCached() ) {
			return true;
		}
	}
	return false;
}
 
Example 2
@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 3
private boolean determineCanWriteToCache(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy) {
	if ( cacheAccessStrategy == null ) {
		return false;
	}

	return persistentClass.isCached();
}