HHH-15791 Avoid excessive Session casts to EventSource

This commit is contained in:
Sanne Grinovero 2022-12-01 22:09:40 +00:00 committed by Sanne Grinovero
parent 6c2bff76c9
commit 329ccaa7a1
50 changed files with 153 additions and 117 deletions

View File

@ -42,6 +42,7 @@ import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
import org.hibernate.internal.CoreMessageLogger;
@ -704,7 +705,7 @@ public class HSQLLegacyDialect extends Dialect {
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session)
public void lock(Object id, Object version, Object object, int timeout, EventSource session)
throws StaleObjectStateException, JDBCException {
if ( getLockMode().greaterThan( LockMode.READ ) ) {
LOG.hsqldbSupportsOnlyReadCommittedIsolation();

View File

@ -19,6 +19,7 @@ import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.spi.EventSource;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.persister.collection.CollectionPersister;
@ -52,7 +53,7 @@ public abstract class AbstractEntityInsertAction extends EntityAction {
Object instance,
boolean isVersionIncrementDisabled,
EntityPersister persister,
SharedSessionContractImplementor session) {
EventSource session) {
super( session, id, instance, persister );
this.state = state;
this.isVersionIncrementDisabled = isVersionIncrementDisabled;
@ -177,7 +178,7 @@ public abstract class AbstractEntityInsertAction extends EntityAction {
protected abstract EntityKey getEntityKey();
@Override
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
super.afterDeserialize( session );
// IMPL NOTE: non-flushed changes code calls this method with session == null...
// guard against NullPointerException

View File

@ -164,7 +164,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
public static void schedule(SharedSessionContractImplementor session, EntityPersister... affectedQueryables) {
final BulkOperationCleanupAction action = new BulkOperationCleanupAction( session, affectedQueryables );
if ( session.isEventSource() ) {
( (EventSource) session ).getActionQueue().addAction( action );
session.asEventSource().getActionQueue().addAction( action );
}
else {
action.getAfterTransactionCompletionProcess().doAfterTransactionCompletion( true, session );
@ -174,7 +174,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
public static void schedule(SharedSessionContractImplementor session, Set<String> affectedQueryables) {
final BulkOperationCleanupAction action = new BulkOperationCleanupAction( session, affectedQueryables );
if ( session.isEventSource() ) {
( (EventSource) session ).getActionQueue().addAction( action );
session.asEventSource().getActionQueue().addAction( action );
}
else {
action.getAfterTransactionCompletionProcess().doAfterTransactionCompletion( true, session );
@ -302,7 +302,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
}
@Override
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
// nop
}
}

View File

@ -30,7 +30,7 @@ import org.hibernate.pretty.MessageHelper;
public abstract class CollectionAction implements Executable, Serializable, Comparable<CollectionAction> {
private transient CollectionPersister persister;
private transient SharedSessionContractImplementor session;
private transient EventSource session;
private final PersistentCollection<?> collection;
private final Object key;
@ -40,7 +40,7 @@ public abstract class CollectionAction implements Executable, Serializable, Comp
final CollectionPersister persister,
final PersistentCollection<?> collection,
final Object key,
final SharedSessionContractImplementor session) {
final EventSource session) {
this.persister = persister;
this.session = session;
this.key = key;
@ -57,7 +57,7 @@ public abstract class CollectionAction implements Executable, Serializable, Comp
*
* @param session The session being deserialized
*/
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
if ( this.session != null || this.persister != null ) {
throw new IllegalStateException( "already attached to a session." );
}
@ -122,7 +122,7 @@ public abstract class CollectionAction implements Executable, Serializable, Comp
return finalKey;
}
protected final SharedSessionContractImplementor getSession() {
protected final EventSource getSession() {
return session;
}
@ -185,7 +185,7 @@ public abstract class CollectionAction implements Executable, Serializable, Comp
}
protected EventSource eventSource() {
return (EventSource) getSession();
return getSession();
}
/**

View File

@ -9,6 +9,7 @@ package org.hibernate.action.internal;
import org.hibernate.HibernateException;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCollectionRecreateEvent;
import org.hibernate.event.spi.PostCollectionRecreateEventListener;
import org.hibernate.event.spi.PreCollectionRecreateEvent;
@ -32,7 +33,7 @@ public final class CollectionRecreateAction extends CollectionAction {
final PersistentCollection<?> collection,
final CollectionPersister persister,
final Object id,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, collection, id, session );
}

View File

@ -10,6 +10,7 @@ import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCollectionRemoveEvent;
import org.hibernate.event.spi.PostCollectionRemoveEventListener;
import org.hibernate.event.spi.PreCollectionRemoveEvent;
@ -43,7 +44,7 @@ public final class CollectionRemoveAction extends CollectionAction {
final CollectionPersister persister,
final Object id,
final boolean emptySnapshot,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, collection, id, session );
if ( collection == null ) {
throw new AssertionFailure("collection == null");
@ -73,7 +74,7 @@ public final class CollectionRemoveAction extends CollectionAction {
final CollectionPersister persister,
final Object id,
final boolean emptySnapshot,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, null, id, session );
if ( affectedOwner == null ) {
throw new AssertionFailure("affectedOwner == null");
@ -93,7 +94,7 @@ public final class CollectionRemoveAction extends CollectionAction {
public CollectionRemoveAction(
final CollectionPersister persister,
final Object id,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, null, id, session );
emptySnapshot = false;
affectedOwner = null;

View File

@ -10,6 +10,7 @@ import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCollectionUpdateEvent;
import org.hibernate.event.spi.PostCollectionUpdateEventListener;
import org.hibernate.event.spi.PreCollectionUpdateEvent;
@ -38,7 +39,7 @@ public final class CollectionUpdateAction extends CollectionAction {
final CollectionPersister persister,
final Object id,
final boolean emptySnapshot,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, collection, id, session );
this.emptySnapshot = emptySnapshot;
}

View File

@ -33,7 +33,7 @@ public abstract class EntityAction
private final Object id;
private transient Object instance;
private transient SharedSessionContractImplementor session;
private transient EventSource session;
private transient EntityPersister persister;
private transient boolean veto;
@ -47,7 +47,7 @@ public abstract class EntityAction
* @param persister The entity persister
*/
protected EntityAction(
SharedSessionContractImplementor session,
EventSource session,
Object id,
Object instance,
EntityPersister persister) {
@ -123,7 +123,7 @@ public abstract class EntityAction
*
* @return The session from which this action originated.
*/
public final SharedSessionContractImplementor getSession() {
public final EventSource getSession() {
return session;
}
@ -167,7 +167,7 @@ public abstract class EntityAction
* @param session The session being deserialized
*/
@Override
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
if ( this.session != null || this.persister != null ) {
throw new IllegalStateException( "already attached to a session." );
}
@ -181,7 +181,7 @@ public abstract class EntityAction
}
protected EventSource eventSource() {
return (EventSource) getSession();
return getSession();
}
/**

View File

@ -16,6 +16,7 @@ import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.service.spi.EventListenerGroup;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCommitDeleteEventListener;
import org.hibernate.event.spi.PostDeleteEvent;
import org.hibernate.event.spi.PostDeleteEventListener;
@ -55,7 +56,7 @@ public class EntityDeleteAction extends EntityAction {
final Object instance,
final EntityPersister persister,
final boolean isCascadeDeleteEnabled,
final SessionImplementor session) {
final EventSource session) {
super( session, id, instance, persister );
this.version = version;
this.isCascadeDeleteEnabled = isCascadeDeleteEnabled;
@ -79,7 +80,7 @@ public class EntityDeleteAction extends EntityAction {
* @param persister The entity persister
* @param session The session
*/
public EntityDeleteAction(final Object id, final EntityPersister persister, final SessionImplementor session) {
public EntityDeleteAction(final Object id, final EntityPersister persister, final EventSource session) {
super( session, id, null, persister );
version = null;
isCascadeDeleteEnabled = false;

View File

@ -12,6 +12,7 @@ import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.service.spi.EventListenerGroup;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCommitInsertEventListener;
import org.hibernate.event.spi.PostInsertEvent;
import org.hibernate.event.spi.PostInsertEventListener;
@ -49,7 +50,7 @@ public class EntityIdentityInsertAction extends AbstractEntityInsertAction {
final Object instance,
final EntityPersister persister,
final boolean isVersionIncrementDisabled,
final SharedSessionContractImplementor session,
final EventSource session,
final boolean isDelayed) {
super(
isDelayed ? generateDelayedPostInsertIdentifier() : null,

View File

@ -18,6 +18,7 @@ import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.service.spi.EventListenerGroup;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCommitInsertEventListener;
import org.hibernate.event.spi.PostInsertEvent;
import org.hibernate.event.spi.PostInsertEventListener;
@ -54,7 +55,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
final Object version,
final EntityPersister persister,
final boolean isVersionIncrementDisabled,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( id, state, instance, isVersionIncrementDisabled, persister, session );
this.version = version;
}

View File

@ -20,6 +20,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.service.spi.EventListenerGroup;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostCommitUpdateEventListener;
import org.hibernate.event.spi.PostUpdateEvent;
import org.hibernate.event.spi.PostUpdateEventListener;
@ -76,7 +77,7 @@ public class EntityUpdateAction extends EntityAction {
final Object instance,
final Object rowId,
final EntityPersister persister,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( session, id, instance, persister );
this.state = state;
this.previousState = previousState;

View File

@ -6,14 +6,14 @@
*/
package org.hibernate.action.internal;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.EntityPersister;
public final class OrphanRemovalAction extends EntityDeleteAction {
public OrphanRemovalAction(
Object id, Object[] state, Object version, Object instance,
EntityPersister persister, boolean isCascadeDeleteEnabled, SessionImplementor session) {
EntityPersister persister, boolean isCascadeDeleteEnabled, EventSource session) {
super( id, state, version, instance, persister, isCascadeDeleteEnabled, session );
}
}

View File

@ -11,6 +11,7 @@ import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.CollectionEntry;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.collection.CollectionPersister;
/**
@ -35,7 +36,7 @@ public final class QueuedOperationCollectionAction extends CollectionAction {
final PersistentCollection<?> collection,
final CollectionPersister persister,
final Object id,
final SharedSessionContractImplementor session) {
final EventSource session) {
super( persister, collection, id, session );
}

View File

@ -22,6 +22,7 @@ import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.IdentitySet;
import org.hibernate.pretty.MessageHelper;
@ -293,7 +294,7 @@ public class UnresolvedEntityInsertActions {
*/
public static UnresolvedEntityInsertActions deserialize(
ObjectInputStream ois,
SessionImplementor session) throws IOException, ClassNotFoundException {
EventSource session) throws IOException, ClassNotFoundException {
final UnresolvedEntityInsertActions rtn = new UnresolvedEntityInsertActions();

View File

@ -9,7 +9,7 @@ package org.hibernate.action.spi;
import java.io.Serializable;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
/**
* An operation which may be scheduled for later execution. Usually, the operation is a database
@ -59,7 +59,7 @@ public interface Executable {
/**
* Reconnect to session after deserialization
*
* @param session The session being deserialized
* @param session The session being deserialized; must be an EventSource
*/
void afterDeserialize(SharedSessionContractImplementor session);
void afterDeserialize(EventSource session);
}

View File

@ -196,7 +196,7 @@ public class CollectionCacheInvalidator
CollectionPersister persister,
PersistentCollection<?> collection,
Object key,
SharedSessionContractImplementor session) {
EventSource session) {
super( persister, collection, key, session );
}
@ -208,7 +208,6 @@ public class CollectionCacheInvalidator
beforeExecutions();
return getAfterTransactionCompletionProcess();
}
}
}

View File

@ -26,7 +26,7 @@ import org.hibernate.dialect.unique.UniqueDelegate;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.jdbc.env.spi.SchemaNameResolver;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Constraint;
@ -877,7 +877,7 @@ public class SpannerDialect extends Dialect {
@Override
public void lock(
Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session)
Object id, Object version, Object object, int timeout, EventSource session)
throws StaleObjectStateException, LockingStrategyException {
// Do nothing. Cloud Spanner doesn't have have locking strategies.
}

View File

@ -7,7 +7,7 @@
package org.hibernate.dialect.lock;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
/**
* A strategy abstraction for how locks are obtained in the underlying database.
@ -37,6 +37,6 @@ public interface LockingStrategy {
* the requested lock.
* @throws LockingStrategyException Indicates a failure in the lock attempt
*/
void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session)
void lock(Object id, Object version, Object object, int timeout, EventSource session)
throws StaleObjectStateException, LockingStrategyException;
}

View File

@ -10,7 +10,6 @@ import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.action.internal.EntityIncrementVersionProcess;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.Lockable;
@ -43,13 +42,13 @@ public class OptimisticForceIncrementLockingStrategy implements LockingStrategy
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
if ( !lockable.isVersioned() ) {
throw new HibernateException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}
final EntityEntry entry = session.getPersistenceContextInternal().getEntry( object );
// Register the EntityIncrementVersionProcess action to run just prior to transaction commit.
( (EventSource) session ).getActionQueue().registerProcess( new EntityIncrementVersionProcess( object ) );
session.getActionQueue().registerProcess( new EntityIncrementVersionProcess( object ) );
}
protected LockMode getLockMode() {

View File

@ -9,7 +9,6 @@ package org.hibernate.dialect.lock;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.action.internal.EntityVerifyVersionProcess;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.Lockable;
@ -41,12 +40,12 @@ public class OptimisticLockingStrategy implements LockingStrategy {
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
if ( !lockable.isVersioned() ) {
throw new OptimisticEntityLockException( object, "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}
// Register the EntityVerifyVersionProcess action to run just prior to transaction commit.
( (EventSource) session ).getActionQueue().registerProcess( new EntityVerifyVersionProcess( object ) );
session.getActionQueue().registerProcess( new EntityVerifyVersionProcess( object ) );
}
protected LockMode getLockMode() {

View File

@ -9,7 +9,7 @@ package org.hibernate.dialect.lock;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Lockable;
@ -42,7 +42,7 @@ public class PessimisticForceIncrementLockingStrategy implements LockingStrategy
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
if ( !lockable.isVersioned() ) {
throw new HibernateException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}

View File

@ -16,7 +16,7 @@ import org.hibernate.LockOptions;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.sql.SimpleSelect;
@ -53,7 +53,7 @@ public class PessimisticReadSelectLockingStrategy extends AbstractSelectLockingS
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
final String sql = determineSql( timeout );
final SessionFactoryImplementor factory = session.getFactory();
try {

View File

@ -15,7 +15,7 @@ import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
@ -69,7 +69,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy {
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
if ( !lockable.isVersioned() ) {
throw new HibernateException( "write locks via update not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}

View File

@ -16,7 +16,7 @@ import org.hibernate.LockOptions;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.sql.SimpleSelect;
@ -52,7 +52,7 @@ public class PessimisticWriteSelectLockingStrategy extends AbstractSelectLocking
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
final String sql = determineSql( timeout );
final SessionFactoryImplementor factory = session.getFactory();
try {

View File

@ -15,7 +15,7 @@ import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
@ -68,7 +68,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy {
}
@Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, int timeout, EventSource session) {
if ( !lockable.isVersioned() ) {
throw new HibernateException( "write locks via update not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}

View File

@ -16,7 +16,7 @@ import org.hibernate.LockOptions;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.sql.SimpleSelect;
@ -51,7 +51,7 @@ public class SelectLockingStrategy extends AbstractSelectLockingStrategy {
Object version,
Object object,
int timeout,
SharedSessionContractImplementor session) throws StaleObjectStateException, JDBCException {
EventSource session) throws StaleObjectStateException, JDBCException {
final String sql = determineSql( timeout );
final SessionFactoryImplementor factory = session.getFactory();
final Lockable lockable = getLockable();

View File

@ -15,7 +15,7 @@ import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.pretty.MessageHelper;
@ -72,7 +72,7 @@ public class UpdateLockingStrategy implements LockingStrategy {
Object version,
Object object,
int timeout,
SharedSessionContractImplementor session) throws StaleObjectStateException, JDBCException {
EventSource session) throws StaleObjectStateException, JDBCException {
final String lockableEntityName = lockable.getEntityName();
if ( !lockable.isVersioned() ) {
throw new HibernateException( "write locks via update not supported for non-versioned entities [" + lockableEntityName + "]" );

View File

@ -270,23 +270,23 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
if ( cacheAccess == null ) {
return;
}
final SharedSessionContractImplementor s = session();
final EntityMappingType rootEntityDescriptor = persister.getRootEntityDescriptor();
final EntityPersister rootEntityPersister = rootEntityDescriptor.getEntityPersister();
final Object cacheKey = cacheAccess.generateCacheKey( naturalIdValues, rootEntityPersister, session() );
final Object cacheKey = cacheAccess.generateCacheKey( naturalIdValues, rootEntityPersister, s );
final SessionFactoryImplementor factory = session().getFactory();
final SessionFactoryImplementor factory = s.getFactory();
final StatisticsImplementor statistics = factory.getStatistics();
switch ( source ) {
case LOAD: {
if ( CacheHelper.fromSharedCache( session(), cacheKey, cacheAccess ) != null ) {
if ( CacheHelper.fromSharedCache( s, cacheKey, cacheAccess ) != null ) {
// prevent identical re-cachings
return;
}
final boolean put = cacheAccess.putFromLoad(
session(),
s,
cacheKey,
id,
null
@ -302,7 +302,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
break;
}
case INSERT: {
final boolean put = cacheAccess.insert( session(), cacheKey, id );
final boolean put = cacheAccess.insert( s, cacheKey, id );
if ( put && statistics.isStatisticsEnabled() ) {
statistics.naturalIdCachePut(
rootEntityDescriptor.getNavigableRole(),
@ -310,7 +310,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
);
}
( (EventSource) session() ).getActionQueue().registerProcess(
s.asEventSource().getActionQueue().registerProcess(
(success, session) -> {
if ( success ) {
final boolean put1 = cacheAccess.afterInsert( session, cacheKey, id );
@ -330,16 +330,16 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
break;
}
case UPDATE: {
final Object previousCacheKey = cacheAccess.generateCacheKey( previousNaturalIdValues, rootEntityPersister, session() );
final Object previousCacheKey = cacheAccess.generateCacheKey( previousNaturalIdValues, rootEntityPersister, s );
if ( cacheKey.equals( previousCacheKey ) ) {
// prevent identical re-caching, solves HHH-7309
return;
}
final SoftLock removalLock = cacheAccess.lockItem( session(), previousCacheKey, null );
cacheAccess.remove( session(), previousCacheKey);
final SoftLock removalLock = cacheAccess.lockItem( s, previousCacheKey, null );
cacheAccess.remove( s, previousCacheKey);
final SoftLock lock = cacheAccess.lockItem( session(), cacheKey, null );
final boolean put = cacheAccess.update( session(), cacheKey, id );
final SoftLock lock = cacheAccess.lockItem( s, cacheKey, null );
final boolean put = cacheAccess.update( s, cacheKey, id );
if ( put && statistics.isStatisticsEnabled() ) {
statistics.naturalIdCachePut(
rootEntityDescriptor.getNavigableRole(),
@ -347,12 +347,12 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
);
}
( (EventSource) session() ).getActionQueue().registerProcess(
s.asEventSource().getActionQueue().registerProcess(
(success, session) -> {
cacheAccess.unlockItem( session(), previousCacheKey, removalLock );
cacheAccess.unlockItem( s, previousCacheKey, removalLock );
if (success) {
final boolean put12 = cacheAccess.afterUpdate(
session(),
s,
cacheKey,
id,
lock
@ -366,7 +366,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
}
}
else {
cacheAccess.unlockItem( session(), cacheKey, lock );
cacheAccess.unlockItem( s, cacheKey, lock );
}
}
);

View File

@ -43,6 +43,7 @@ import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.action.spi.Executable;
import org.hibernate.cache.CacheException;
import org.hibernate.engine.internal.NonNullableTransientDependencies;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
@ -905,7 +906,7 @@ public class ActionQueue {
* @throws IOException indicates a problem reading from the stream
* @throws ClassNotFoundException Generally means we were unable to locate user classes.
*/
public static ActionQueue deserialize(ObjectInputStream ois, SessionImplementor session)
public static ActionQueue deserialize(ObjectInputStream ois, EventSource session)
throws IOException, ClassNotFoundException {
final boolean traceEnabled = LOG.isTraceEnabled();
if ( traceEnabled ) {

View File

@ -19,6 +19,7 @@ import java.util.List;
import java.util.Set;
import org.hibernate.action.spi.Executable;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.util.collections.CollectionHelper;
/**
@ -345,7 +346,7 @@ public class ExecutableList<E extends Executable & Comparable<? super E> & Seria
*
* @param session The session with which to associate the {@code Executable}s
*/
public void afterDeserialize(SessionImplementor session) {
public void afterDeserialize(EventSource session) {
for ( E e : executables ) {
e.afterDeserialize( session );
}

View File

@ -40,6 +40,7 @@ import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.event.spi.DeleteContext;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.PersistContext;
import org.hibernate.event.spi.RefreshContext;
@ -297,6 +298,11 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
return delegate.isEventSource();
}
@Override
public EventSource asEventSource() {
return delegate.asEventSource();
}
@Override
public void afterScrollOperation() {
delegate.afterScrollOperation();

View File

@ -15,6 +15,7 @@ import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.query.Query;
import org.hibernate.SharedSessionContract;
import org.hibernate.Transaction;
@ -355,6 +356,8 @@ public interface SharedSessionContractImplementor
boolean isEventSource();
EventSource asEventSource();
void afterScrollOperation();
boolean shouldAutoClose();

View File

@ -9,11 +9,8 @@ package org.hibernate.event.internal;
import org.hibernate.LockOptions;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreLogging;
import org.hibernate.loader.ast.internal.LoaderHelper;
import org.jboss.logging.Logger;
/**
* A convenience base class for listeners that respond to requests to perform a
* pessimistic lock upgrade on an entity.
@ -21,7 +18,6 @@ import org.jboss.logging.Logger;
* @author Gavin King
*/
public abstract class AbstractLockUpgradeEventListener extends AbstractReassociateEventListener {
private static final Logger log = CoreLogging.logger( AbstractLockUpgradeEventListener.class );
/**
* Performs a pessimistic lock upgrade on a given entity, if needed.

View File

@ -1813,6 +1813,11 @@ public class SessionImpl
return true;
}
@Override
public EventSource asEventSource() {
return this;
}
@Override
public boolean isDefaultReadOnly() {
return persistenceContext.isDefaultReadOnly();

View File

@ -27,6 +27,7 @@ import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGeneratorHelper;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
@ -587,6 +588,11 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
return false;
}
@Override
public EventSource asEventSource() {
throw new HibernateException( "Illegal Cast to EventSource - guard by invoking isEventSource() first" );
}
public boolean isDefaultReadOnly() {
return false;
}

View File

@ -124,7 +124,7 @@ public class IdentifierLoadAccessImpl<T> implements IdentifierLoadAccess<T>, Jav
@SuppressWarnings( "unchecked" )
protected T doGetReference(Object id) {
final SessionImplementor session = context.getSession();
final EventSource eventSource = (EventSource) session;
final EventSource eventSource = session.asEventSource();
final LoadQueryInfluencers loadQueryInfluencers = session.getLoadQueryInfluencers();
final JpaCompliance jpaCompliance = session.getFactory().getSessionFactoryOptions().getJpaCompliance();
@ -169,7 +169,7 @@ public class IdentifierLoadAccessImpl<T> implements IdentifierLoadAccess<T>, Jav
@SuppressWarnings( "unchecked" )
protected final T doLoad(Object id) {
final SessionImplementor session = context.getSession();
final EventSource eventSource = (EventSource) session;
final EventSource eventSource = session.asEventSource();
final LoadQueryInfluencers loadQueryInfluencers = session.getLoadQueryInfluencers();
final JpaCompliance jpaCompliance = session.getFactory().getSessionFactoryOptions().getJpaCompliance();

View File

@ -14,6 +14,7 @@ import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.spi.EventSource;
import org.hibernate.loader.LoaderLogging;
import org.hibernate.persister.entity.EntityPersister;
@ -22,7 +23,7 @@ import org.hibernate.persister.entity.EntityPersister;
*/
public class LoaderHelper {
public static void upgradeLock(Object object, EntityEntry entry, LockOptions lockOptions, SharedSessionContractImplementor session) {
public static void upgradeLock(Object object, EntityEntry entry, LockOptions lockOptions, EventSource session) {
LockMode requestedLockMode = lockOptions.getLockMode();
if ( requestedLockMode.greaterThan( entry.getLockMode() ) ) {
// The user requested a "greater" (i.e. more restrictive) form of

View File

@ -80,7 +80,7 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
}
@Override
public List<T> load(Object[] ids, MultiIdLoadOptions loadOptions, SharedSessionContractImplementor session) {
public List<T> load(Object[] ids, MultiIdLoadOptions loadOptions, EventSource session) {
assert ids != null;
if ( loadOptions.isOrderReturnEnabled() ) {
@ -93,7 +93,7 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
private List<T> performOrderedMultiLoad(
Object[] ids,
SharedSessionContractImplementor session,
EventSource session,
MultiIdLoadOptions loadOptions) {
if ( log.isTraceEnabled() ) {
log.tracef( "#performOrderedMultiLoad(`%s`, ..)", entityDescriptor.getEntityName() );
@ -141,7 +141,7 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
id,
entityDescriptor.getMappedClass().getName(),
lockOptions,
(EventSource) session,
session,
getReadOnlyFromLoadQueryInfluencers(session)
);
@ -343,7 +343,7 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
private List<T> performUnorderedMultiLoad(
Object[] ids,
SharedSessionContractImplementor session,
EventSource session,
MultiIdLoadOptions loadOptions) {
assert !loadOptions.isOrderReturnEnabled();
assert ids != null;
@ -382,7 +382,7 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
id,
entityDescriptor.getMappedClass().getName(),
lockOptions,
(EventSource) session,
session,
getReadOnlyFromLoadQueryInfluencers( session )
);

View File

@ -9,6 +9,7 @@ package org.hibernate.loader.ast.spi;
import java.util.List;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
/**
* Loader subtype for loading multiple entities by multiple identifier values.
@ -17,5 +18,5 @@ public interface MultiIdEntityLoader<T> extends MultiLoader<T> {
/**
* Load multiple entities by id. The exact result depends on the passed options.
*/
<K> List<T> load(K[] ids, MultiIdLoadOptions options, SharedSessionContractImplementor session);
<K> List<T> load(K[] ids, MultiIdLoadOptions options, EventSource session);
}

View File

@ -70,7 +70,7 @@ public class CacheEntityLoaderHelper {
EntityKey keyToLoad,
LoadEventListener.LoadType options,
LockOptions lockOptions,
SharedSessionContractImplementor session) {
EventSource session) {
final Object old = session.getEntityUsingInterceptor( keyToLoad );
if ( old != null ) {

View File

@ -2073,7 +2073,7 @@ public abstract class AbstractEntityPersister
Object version,
Object object,
LockMode lockMode,
SharedSessionContractImplementor session) throws HibernateException {
EventSource session) throws HibernateException {
getLocker( lockMode ).lock( id, version, object, LockOptions.WAIT_FOREVER, session );
}
@ -2083,7 +2083,7 @@ public abstract class AbstractEntityPersister
Object version,
Object object,
LockOptions lockOptions,
SharedSessionContractImplementor session) throws HibernateException {
EventSource session) throws HibernateException {
getLocker( lockOptions.getLockMode() ).lock( id, version, object, lockOptions.getTimeOut(), session );
}
@ -3493,8 +3493,8 @@ public abstract class AbstractEntityPersister
final Object identifier = entityKey.getIdentifier();
Object loaded = null;
if ( canReadFromCache && session instanceof EventSource ) {
LoadEvent loadEvent = new LoadEvent( identifier, entity, (EventSource) session, false );
if ( canReadFromCache && session.isEventSource() ) {
LoadEvent loadEvent = new LoadEvent( identifier, entity, session.asEventSource(), false );
loaded = CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache( loadEvent, this, entityKey );
}
if ( loaded == null ) {
@ -3544,7 +3544,7 @@ public abstract class AbstractEntityPersister
}
@Override
public List<?> multiLoad(Object[] ids, SharedSessionContractImplementor session, MultiIdLoadOptions loadOptions) {
public List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) {
return multiIdEntityLoader.load( ids, loadOptions, session );
}

View File

@ -26,6 +26,7 @@ import org.hibernate.engine.spi.EntityEntryFactory;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.internal.FilterAliasGenerator;
import org.hibernate.internal.TableGroupFilterAliasGenerator;
@ -550,17 +551,17 @@ public interface EntityPersister
*
* @return The loaded, matching entities
*/
List<?> multiLoad(Object[] ids, SharedSessionContractImplementor session, MultiIdLoadOptions loadOptions);
List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions);
/**
* Do a version check (optional operation)
*/
void lock(Object id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session);
void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session);
/**
* Do a version check (optional operation)
*/
void lock(Object id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session);
void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session);
/**
* Persist an instance

View File

@ -589,7 +589,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
// We have to query the second level cache if reference cache entries are used
if ( instance == null && entityDescriptor.canUseReferenceCacheEntries() ) {
instance = CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache(
(EventSource) rowProcessingState.getSession(),
rowProcessingState.getSession().asEventSource(),
null,
lockMode,
entityDescriptor,

View File

@ -63,9 +63,10 @@ public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSo
this.processingOptions = processingOptions;
this.loadingEntityEntryConsumer = loadingEntityEntryListener;
if ( executionContext.getSession() instanceof EventSource ) {
preLoadEvent = new PreLoadEvent( (EventSource) executionContext.getSession() );
postLoadEvent = new PostLoadEvent( (EventSource) executionContext.getSession() );
if ( executionContext.getSession().isEventSource() ) {
final EventSource eventSource = executionContext.getSession().asEventSource();
preLoadEvent = new PreLoadEvent( eventSource );
postLoadEvent = new PostLoadEvent( eventSource );
}
else {
preLoadEvent = null;

View File

@ -35,6 +35,7 @@ import org.hibernate.engine.spi.EntityEntryFactory;
import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.internal.FilterAliasGenerator;
import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
@ -357,16 +358,16 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
}
@Override
public List<?> multiLoad(Object[] ids, SharedSessionContractImplementor session, MultiIdLoadOptions loadOptions) {
public List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) {
return Collections.emptyList();
}
@Override
public void lock(Object id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session) {
}
@Override
public void lock(Object id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session) {
}
@Override

View File

@ -21,6 +21,7 @@ import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.action.spi.Executable;
import org.hibernate.engine.spi.ExecutableList;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.testing.orm.junit.BaseUnitTest;
import org.junit.jupiter.api.AfterEach;
@ -97,7 +98,7 @@ public class NonSortedExecutableListTest {
}
@Override
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
this.afterDeserializeCalled = true;
}

View File

@ -21,6 +21,7 @@ import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.action.spi.Executable;
import org.hibernate.engine.spi.ExecutableList;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.testing.orm.junit.BaseUnitTest;
import org.junit.jupiter.api.AfterEach;
@ -95,7 +96,7 @@ public class SortedExecutableListTest {
}
@Override
public void afterDeserialize(SharedSessionContractImplementor session) {
public void afterDeserialize(EventSource session) {
this.afterDeserializeCalled = true;
}

View File

@ -31,6 +31,7 @@ import org.hibernate.engine.spi.EntityEntryFactory;
import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.internal.FilterAliasGenerator;
import org.hibernate.jpa.boot.spi.Bootstrap;
@ -397,16 +398,16 @@ public class PersisterClassProviderTest {
}
@Override
public List multiLoad(Object[] ids, SharedSessionContractImplementor session, MultiIdLoadOptions loadOptions) {
public List multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) {
return Collections.emptyList();
}
@Override
public void lock(Object id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session) {
}
@Override
public void lock(Object id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session) {
public void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session) {
}
@Override

View File

@ -33,6 +33,7 @@ import org.hibernate.engine.spi.EntityEntryFactory;
import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.UUIDHexGenerator;
import org.hibernate.internal.FilterAliasGenerator;
@ -398,7 +399,7 @@ public class CustomPersister implements EntityPersister {
}
@Override
public List<?> multiLoad(Object[] ids, SharedSessionContractImplementor session, MultiIdLoadOptions loadOptions) {
public List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) {
return Collections.emptyList();
}
@ -448,28 +449,29 @@ public class CustomPersister implements EntityPersister {
}
/**
* @see EntityPersister#lock(Object, Object, Object, LockMode, SharedSessionContractImplementor)
* @see EntityPersister#lock(Object, Object, Object, LockMode, EventSource)
*/
@Override
public void lock(
Object id,
Object version,
Object object,
LockOptions lockOptions,
SharedSessionContractImplementor session
EventSource session
) throws HibernateException {
throw new UnsupportedOperationException();
}
/**
* @see EntityPersister#lock(Object, Object, Object, LockMode, SharedSessionContractImplementor)
* @see EntityPersister#lock(Object, Object, Object, LockMode, EventSource)
*/
public void lock(
Object id,
Object version,
Object object,
LockMode lockMode,
SharedSessionContractImplementor session
EventSource session
) throws HibernateException {
throw new UnsupportedOperationException();