HHH-9231 : Avoid updating collection 2LC if contains entity added in tx
(cherry picked from commit 4851ab01df
)
This commit is contained in:
parent
cf913c16d4
commit
ea388c8c82
|
@ -352,11 +352,13 @@ public class CollectionLoadContext {
|
|||
final CacheKey cacheKey = session.generateCacheKey( lce.getKey(), persister.getKeyType(), persister.getRole() );
|
||||
|
||||
boolean isPutFromLoad = true;
|
||||
for (Serializable id : entry.getState()) {
|
||||
EntityPersister entityPersister = ((QueryableCollection) persister).getElementPersister();
|
||||
if ( session.getPersistenceContext().wasInsertedDuringTransaction( entityPersister, id ) ) {
|
||||
isPutFromLoad = false;
|
||||
break;
|
||||
if ( persister.getElementType().isAssociationType() ) {
|
||||
for ( Serializable id : entry.getState() ) {
|
||||
EntityPersister entityPersister = ( (QueryableCollection) persister ).getElementPersister();
|
||||
if ( session.getPersistenceContext().wasInsertedDuringTransaction( entityPersister, id ) ) {
|
||||
isPutFromLoad = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue