HHH-9231 : Avoid updating collection 2LC if contains entity added in tx

(cherry picked from commit 4851ab01df)
This commit is contained in:
Gail Badner 2014-06-18 10:02:37 -07:00
parent 0b0516870d
commit ec17bcbc29
1 changed files with 7 additions and 5 deletions

View File

@ -337,6 +337,7 @@ public class CollectionLoadContext {
final CacheKey cacheKey = session.generateCacheKey( lce.getKey(), persister.getKeyType(), persister.getRole() );
boolean isPutFromLoad = true;
if ( persister.getElementType().isAssociationType() ) {
for ( Serializable id : entry.getState() ) {
EntityPersister entityPersister = ( (QueryableCollection) persister ).getElementPersister();
if ( session.getPersistenceContext().wasInsertedDuringTransaction( entityPersister, id ) ) {
@ -344,6 +345,7 @@ public class CollectionLoadContext {
break;
}
}
}
// CollectionRegionAccessStrategy has no update, so avoid putting uncommitted data via putFromLoad
if (isPutFromLoad) {