minor code cleanups

This commit is contained in:
Gavin King 2024-12-18 08:18:16 +01:00
parent d65b53cdb7
commit 9b1ee66355
2 changed files with 11 additions and 9 deletions

View File

@ -14,9 +14,10 @@
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.FastSessionServices;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.pretty.MessageHelper;
import static org.hibernate.internal.util.StringHelper.unqualify;
import static org.hibernate.pretty.MessageHelper.infoString;
/**
* Any action relating to insert/update/delete of a collection
@ -61,14 +62,14 @@ public void afterDeserialize(EventSource session) {
// guard against NullPointerException
if ( session != null ) {
this.session = session;
this.persister = session.getFactory().getRuntimeMetamodels().getMappingMetamodel().getCollectionDescriptor( collectionRole );
this.persister = session.getFactory().getMappingMetamodel().getCollectionDescriptor( collectionRole );
}
}
@Override
public final void beforeExecutions() throws CacheException {
// we need to obtain the lock before any actions are executed, since this may be an inverse="true"
// bidirectional association and it is one of the earlier entity actions which actually updates
// bidirectional association, and it is one of the earlier entity actions which actually updates
// the database (this action is responsible for second-level cache invalidation only)
if ( persister.hasCache() ) {
final CollectionDataAccess cache = persister.getCacheAccessStrategy();
@ -147,7 +148,7 @@ protected final void evict() throws CacheException {
@Override
public String toString() {
return StringHelper.unqualify( getClass().getName() ) + MessageHelper.infoString( collectionRole, key );
return unqualify( getClass().getName() ) + infoString( collectionRole, key );
}
@Override

View File

@ -11,9 +11,10 @@
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.FastSessionServices;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
import static org.hibernate.internal.util.StringHelper.unqualify;
import static org.hibernate.pretty.MessageHelper.infoString;
/**
* Base class for actions relating to insert/update/delete of an entity
@ -101,7 +102,7 @@ public final Object getId() {
}
public final DelayedPostInsertIdentifier getDelayedId() {
return id instanceof DelayedPostInsertIdentifier ? (DelayedPostInsertIdentifier) id : null;
return id instanceof DelayedPostInsertIdentifier identifier ? identifier : null;
}
/**
@ -143,7 +144,7 @@ public void beforeExecutions() {
@Override
public String toString() {
return StringHelper.unqualify( getClass().getName() ) + MessageHelper.infoString( entityName, id );
return unqualify( getClass().getName() ) + infoString( entityName, id );
}
@Override