mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-14 15:14:56 +00:00
HHH-12587 - Fix NullPointerException when flushing entity with CacheConcurrencyStrategy.NONE.
This commit is contained in:
parent
3aac27d369
commit
21bd9a6a9f
@ -534,7 +534,7 @@ public 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 @@ private boolean determineWhetherToInvalidateCache(
|
||||
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…
x
Reference in New Issue
Block a user