HHH-7309 bug-fix
This commit is contained in:
parent
7c218bbe11
commit
a176931349
|
@ -1862,14 +1862,14 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
CachedNaturalIdValueSource source) {
|
||||
final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister.getNaturalIdCacheAccessStrategy();
|
||||
final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session );
|
||||
if (naturalIdCacheAccessStrategy.get(naturalIdCacheKey, session.getTimestamp()) != null) {
|
||||
return; // prevent identical re-cachings
|
||||
}
|
||||
|
||||
final SessionFactoryImplementor factory = session.getFactory();
|
||||
|
||||
switch ( source ) {
|
||||
case LOAD: {
|
||||
if (naturalIdCacheAccessStrategy.get(naturalIdCacheKey, session.getTimestamp()) != null) {
|
||||
return; // prevent identical re-cachings
|
||||
}
|
||||
final boolean put = naturalIdCacheAccessStrategy.putFromLoad(
|
||||
naturalIdCacheKey,
|
||||
id,
|
||||
|
@ -1916,6 +1916,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
case UPDATE: {
|
||||
final NaturalIdCacheKey previousCacheKey = new NaturalIdCacheKey( previousNaturalIdValues, persister, session );
|
||||
if (naturalIdCacheKey.equals(previousCacheKey)) {
|
||||
return; // prevent identical re-caching, solves HHH-7309
|
||||
}
|
||||
final SoftLock removalLock = naturalIdCacheAccessStrategy.lockItem( previousCacheKey, null );
|
||||
naturalIdCacheAccessStrategy.remove( previousCacheKey );
|
||||
|
||||
|
|
Loading…
Reference in New Issue