push down some methods from SessionImplementor to EventSource

just as recommended by the @Deprecated tags added in H6

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-08-30 22:37:34 +02:00
parent 681bd09b9d
commit ab12b436a2
3 changed files with 6 additions and 51 deletions

View File

@ -38,8 +38,6 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.event.spi.EventManager;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.PersistContext;
import org.hibernate.graph.RootGraph;
import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.jdbc.ReturningWork;
@ -1130,26 +1128,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
delegate.forceFlush( e );
}
@Override
public void merge(String entityName, Object object, MergeContext copiedAlready) throws HibernateException {
delegate.merge( entityName, object, copiedAlready );
}
@Override
public void persist(String entityName, Object object, PersistContext createdAlready) throws HibernateException {
delegate.persist( entityName, object, createdAlready );
}
@Override
public void persistOnFlush(String entityName, Object object, PersistContext copiedAlready) {
delegate.persistOnFlush( entityName, object, copiedAlready );
}
@Override
public void removeOrphanBeforeUpdates(String entityName, Object child) {
delegate.removeOrphanBeforeUpdates( entityName, child );
}
@Override
public SessionImplementor getSession() {
return this;

View File

@ -11,9 +11,6 @@ import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.engine.jdbc.LobCreationContext;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.PersistContext;
import org.hibernate.event.spi.RefreshContext;
import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.spi.QueryImplementor;
@ -103,30 +100,6 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
*/
void lock(String entityName, Object child, LockOptions lockOptions);
/**
* @deprecated OperationalContext should cover this overload I believe
*/
@Deprecated
void merge(String entityName, Object object, MergeContext copiedAlready) throws HibernateException;
/**
* @deprecated OperationalContext should cover this overload I believe
*/
@Deprecated
void persist(String entityName, Object object, PersistContext createdAlready) throws HibernateException;
/**
* @deprecated OperationalContext should cover this overload I believe
*/
@Deprecated
void persistOnFlush(String entityName, Object object, PersistContext copiedAlready);
/**
* @deprecated OperationalContext should cover this overload I believe
*/
@Deprecated
void removeOrphanBeforeUpdates(String entityName, Object child);
@Override
default SessionImplementor asSessionImplementor() {
return this;

View File

@ -42,6 +42,7 @@ public interface EventSource extends SessionImplementor {
* Cascade merge an entity instance
*/
void merge(String entityName, Object object, MergeContext copiedAlready) throws HibernateException;
/**
* Cascade persist an entity instance
*/
@ -51,19 +52,22 @@ public interface EventSource extends SessionImplementor {
* Cascade persist an entity instance during the flush process
*/
void persistOnFlush(String entityName, Object object, PersistContext copiedAlready);
/**
* Cascade refresh an entity instance
*/
void refresh(String entityName, Object object, RefreshContext refreshedAlready) throws HibernateException;
/**
* Cascade delete an entity instance
*/
void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, DeleteContext transientEntities);
/**
* A specialized type of deletion for orphan removal that must occur prior to queued inserts and updates.
*/
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484. This should be removed once action/task
// ordering is improved.
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484.
// This should be removed once action/task ordering is improved.
void removeOrphanBeforeUpdates(String entityName, Object child);
Object load(String entityName, Object identifier);