two minor changes

This commit is contained in:
Gavin King 2024-11-27 13:34:46 +00:00
parent f9d2e8e974
commit 61d0a81231
2 changed files with 15 additions and 14 deletions

View File

@ -157,19 +157,21 @@ public class CollectionCacheInvalidator
}
}
private Object getIdentifier(EventSource session, Object obj) {
Object id = null;
if ( obj != null ) {
id = session.getContextEntityIdentifier( obj );
private Object getIdentifier(EventSource session, Object object) {
if ( object != null ) {
final Object id = session.getContextEntityIdentifier( object );
if ( id == null ) {
final EntityPersister persister = session.getFactory()
.getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor( obj.getClass() );
id = persister.getIdentifier( obj, session );
return session.getFactory().getMappingMetamodel()
.getEntityDescriptor( object.getClass() )
.getIdentifier( object, session );
}
else {
return id;
}
}
return id;
else {
return null;
}
}
private void evict(Object id, CollectionPersister collectionPersister, EventSource session) {

View File

@ -62,10 +62,9 @@ public class OneToOneType extends EntityType {
@Override
public boolean isNull(Object owner, SharedSessionContractImplementor session) {
if ( propertyName != null ) {
final EntityPersister ownerPersister = session.getFactory()
.getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor( entityName );
final EntityPersister ownerPersister =
session.getFactory().getMappingMetamodel()
.getEntityDescriptor( entityName );
final Object id = session.getContextEntityIdentifier( owner );
final EntityKey entityKey = session.generateEntityKey( id, ownerPersister );
return session.getPersistenceContextInternal().isPropertyNull( entityKey, getPropertyName() );