diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdXrefDelegate.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdXrefDelegate.java index 8d52ae4b31..d230eb7b7b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdXrefDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdXrefDelegate.java @@ -490,4 +490,8 @@ public class NaturalIdXrefDelegate { } } } + + public void clear() { + naturalIdResolutionCacheMap.clear(); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java index 2282a994a6..6127417219 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java @@ -256,6 +256,7 @@ public class StatefulPersistenceContext implements PersistenceContext { if ( loadContexts != null ) { loadContexts.cleanup(); } + naturalIdXrefDelegate.clear(); } @Override