mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 08:35:13 +00:00
HHH-13587 Allocate StatefulPersistenceContext#nullAssociations lazily
This commit is contained in:
parent
5bbf417c52
commit
aae670b9b3
@ -176,7 +176,6 @@ public StatefulPersistenceContext(SharedSessionContractImplementor session) {
|
||||
collectionsByKey = new HashMap<>( INIT_COLL_SIZE );
|
||||
arrayHolders = new IdentityHashMap<>( INIT_COLL_SIZE );
|
||||
|
||||
nullAssociations = new HashSet<>( INIT_COLL_SIZE );
|
||||
nonlazyCollections = new ArrayList<>( INIT_COLL_SIZE );
|
||||
}
|
||||
|
||||
@ -1359,16 +1358,19 @@ private Object getIndexInParent(
|
||||
|
||||
@Override
|
||||
public void addNullProperty(EntityKey ownerKey, String propertyName) {
|
||||
if ( nullAssociations == null ) {
|
||||
nullAssociations = new HashSet<>( INIT_COLL_SIZE );
|
||||
}
|
||||
nullAssociations.add( new AssociationKey( ownerKey, propertyName ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPropertyNull(EntityKey ownerKey, String propertyName) {
|
||||
return nullAssociations.contains( new AssociationKey( ownerKey, propertyName ) );
|
||||
return nullAssociations != null && nullAssociations.contains( new AssociationKey( ownerKey, propertyName ) );
|
||||
}
|
||||
|
||||
private void clearNullProperties() {
|
||||
nullAssociations.clear();
|
||||
nullAssociations = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user