Skip to content
Browse files

HHH-7309 bug-fix

  • Loading branch information...
1 parent 7c218bb commit a176931349d2f74f371f1da8e45d17dfbab71c25 @pb00068 pb00068 committed with brmeyer
View
9 hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java
@@ -1862,14 +1862,14 @@ private void managedSharedCacheEntries(
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 void doAfterTransactionCompletion(boolean success, SessionImplementor ses
}
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 );

0 comments on commit a176931

Please sign in to comment.
Something went wrong with that request. Please try again.