HHH-12587 - Fix NullPointerException when flushing entity with CacheConcurrencyStrategy.NONE.
This commit is contained in:
parent
3aac27d369
commit
21bd9a6a9f
|
@ -534,7 +534,7 @@ public abstract class AbstractEntityPersister
|
|||
this.navigableRole = new NavigableRole( persistentClass.getEntityName() );
|
||||
|
||||
if ( creationContext.getSessionFactory().getSessionFactoryOptions().isSecondLevelCacheEnabled() ) {
|
||||
this.canWriteToCache = persistentClass.isCached();
|
||||
this.canWriteToCache = determineCanWriteToCache( persistentClass, cacheAccessStrategy );
|
||||
this.canReadFromCache = determineCanReadFromCache( persistentClass );
|
||||
this.cacheAccessStrategy = cacheAccessStrategy;
|
||||
this.isLazyPropertiesCacheable = persistentClass.getRootClass().isLazyPropertiesCacheable();
|
||||
|
@ -907,6 +907,14 @@ public abstract class AbstractEntityPersister
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean determineCanWriteToCache(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy) {
|
||||
if ( cacheAccessStrategy == null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return persistentClass.isCached();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean determineCanReadFromCache(PersistentClass persistentClass) {
|
||||
if ( persistentClass.isCached() ) {
|
||||
|
|
Loading…
Reference in New Issue