mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-28 06:49:09 +00:00
HHH-7309 bug-fix
This commit is contained in:
parent
d74fa1573b
commit
e644e45367
@ -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 );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user