public interface Interceptor
| Modifier and Type | Method and Description |
|---|---|
default void |
afterTransactionBegin(Transaction tx)
Called when a Hibernate transaction is begun via the Hibernate Transaction
API.
|
default void |
afterTransactionCompletion(Transaction tx)
Called after a transaction is committed or rolled back.
|
default void |
beforeTransactionCompletion(Transaction tx)
Called before a transaction is committed (but not before rollback).
|
default int[] |
findDirty(Object entity,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
Called from flush().
|
default int[] |
findDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
Deprecated.
|
default Object |
getEntity(String entityName,
Object id)
Get a fully loaded entity instance that is cached externally.
|
default Object |
getEntity(String entityName,
Serializable id)
Deprecated.
|
default String |
getEntityName(Object object)
Get the entity name for a persistent or transient instance.
|
default Object |
instantiate(String entityName,
EntityMode entityMode,
Serializable id)
Deprecated.
|
default Object |
instantiate(String entityName,
EntityRepresentationStrategy representationStrategy,
Object id)
Instantiate the entity.
|
default Boolean |
isTransient(Object entity)
Called to distinguish between transient and detached entities.
|
default void |
onCollectionRecreate(Object collection,
Object key)
Called before a collection is (re)created.
|
default void |
onCollectionRecreate(Object collection,
Serializable key)
Deprecated.
|
default void |
onCollectionRemove(Object collection,
Object key)
Called before a collection is deleted.
|
default void |
onCollectionRemove(Object collection,
Serializable key)
Deprecated.
|
default void |
onCollectionUpdate(Object collection,
Object key)
Called before a collection is updated.
|
default void |
onCollectionUpdate(Object collection,
Serializable key)
Deprecated.
|
default void |
onDelete(Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types)
Called before an object is deleted.
|
default void |
onDelete(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types)
Deprecated.
|
default boolean |
onFlushDirty(Object entity,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
Called when an object is detected to be dirty, during a flush.
|
default boolean |
onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
|
default boolean |
onLoad(Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types)
Called just before an object is initialized.
|
default boolean |
onLoad(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types)
Deprecated.
|
default String |
onPrepareStatement(String sql)
Deprecated.
Supply a
StatementInspector instead, if you wish
to inspect and alter SQL statements. |
default boolean |
onSave(Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types)
Called before an object is saved.
|
default boolean |
onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types)
Deprecated.
|
default void |
postFlush(Iterator<Object> entities)
Called after a flush that actually ends in execution of the SQL statements required to synchronize
in-memory state with the database.
|
default void |
preFlush(Iterator<Object> entities)
Called before a flush.
|
@Deprecated default boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
onLoad(Object, Object, Object[], String[], Type[])entity - The entity instance being loadedid - The identifier value being loadedstate - The entity state (which will be pushed into the entity instance)propertyNames - The names of the entity properties, corresponding to the state.types - The types of the entity properties, corresponding to the state.true if the user modified the state in any way.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
entity - The entity instance being loadedid - The identifier value being loadedstate - The entity state (which will be pushed into the entity instance)propertyNames - The names of the entity properties, corresponding to the state.types - The types of the entity properties, corresponding to the state.true if the user modified the state in any way.CallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException
entity - The entity instance detected as being dirty and being flushedid - The identifier of the entitycurrentState - The entity's current statepreviousState - The entity's previous (load time) state.propertyNames - The names of the entity propertiestypes - The types of the entity propertiestrue if the user modified the currentState in any way.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default boolean onFlushDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException
entity - The entity instance detected as being dirty and being flushedid - The identifier of the entitycurrentState - The entity's current statepreviousState - The entity's previous (load time) state.propertyNames - The names of the entity propertiestypes - The types of the entity propertiestrue if the user modified the currentState in any way.CallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
onSave(Object, Object, Object[], String[], Type[])entity - The entity instance whose state is being insertedid - The identifier of the entitystate - The state of the entity which will be insertedpropertyNames - The names of the entity properties.types - The types of the entity propertiesCallbackException - Thrown if the interceptor encounters any problems handling the callback.default boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
entity - The entity instance whose state is being insertedid - The identifier of the entitystate - The state of the entity which will be insertedpropertyNames - The names of the entity properties.types - The types of the entity propertiesCallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
onDelete(Object, Object, Object[], String[], Type[])entity - The entity instance being deletedid - The identifier of the entitystate - The state of the entitypropertyNames - The names of the entity properties.types - The types of the entity propertiesCallbackException - Thrown if the interceptor encounters any problems handling the callback.default void onDelete(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException
entity - The entity instance being deletedid - The identifier of the entitystate - The state of the entitypropertyNames - The names of the entity properties.types - The types of the entity propertiesCallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default void onCollectionRecreate(Object collection, Serializable key) throws CallbackException
onCollectionRecreate(Object, Object)collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default void onCollectionRecreate(Object collection, Object key) throws CallbackException
collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default void onCollectionRemove(Object collection, Serializable key) throws CallbackException
onCollectionRemove(Object, Object)collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default void onCollectionRemove(Object collection, Object key) throws CallbackException
collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default void onCollectionUpdate(Object collection, Serializable key) throws CallbackException
onCollectionUpdate(Object, Object)collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default void onCollectionUpdate(Object collection, Object key) throws CallbackException
collection - The collection instance.key - The collection key value.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default void preFlush(Iterator<Object> entities) throws CallbackException
entities - The entities to be flushed.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default void postFlush(Iterator<Object> entities) throws CallbackException
entities - The entities that were flushed.CallbackException - Thrown if the interceptor encounters any problems handling the callback.default Boolean isTransient(Object entity)
entity - a transient or detached entity@Deprecated default int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)
findDirty(Object, Object, Object[], Object[], String[], Type[])entity - The entity for which to find dirty properties.id - The identifier of the entitycurrentState - The current entity state as taken from the entity instancepreviousState - The state of the entity when it was last synchronized (generally when it was loaded)propertyNames - The names of the entity properties.types - The types of the entity propertiesnull to indicate Hibernate should perform default behaviourCallbackException - Thrown if the interceptor encounters any problems handling the callback.default int[] findDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)
entity - The entity for which to find dirty properties.id - The identifier of the entitycurrentState - The current entity state as taken from the entity instancepreviousState - The state of the entity when it was last synchronized (generally when it was loaded)propertyNames - The names of the entity properties.types - The types of the entity propertiesnull to indicate Hibernate should perform default behaviourCallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException
instantiate(String, EntityRepresentationStrategy, Object) insteadentityName - the name of the entityentityMode - The type of entity instance to be returned.id - the identifier of the new instanceCallbackException - Thrown if the interceptor encounters any problems handling the callback.default Object instantiate(String entityName, EntityRepresentationStrategy representationStrategy, Object id) throws CallbackException
CallbackExceptiondefault String getEntityName(Object object) throws CallbackException
object - an entity instanceCallbackException - Thrown if the interceptor encounters any problems handling the callback.@Deprecated default Object getEntity(String entityName, Serializable id) throws CallbackException
getEntity(String, Object)entityName - the name of the entityid - the instance identifierCallbackException - Thrown if the interceptor encounters any problems handling the callback.default Object getEntity(String entityName, Object id) throws CallbackException
entityName - the name of the entityid - the instance identifierCallbackException - Thrown if the interceptor encounters any problems handling the callback.default void afterTransactionBegin(Transaction tx)
tx - The Hibernate transaction facade objectdefault void beforeTransactionCompletion(Transaction tx)
tx - The Hibernate transaction facade objectdefault void afterTransactionCompletion(Transaction tx)
tx - The Hibernate transaction facade object@Deprecated default String onPrepareStatement(String sql)
StatementInspector instead, if you wish
to inspect and alter SQL statements.sql - sql to be preparedCopyright © 2001-2021 Red Hat, Inc. All Rights Reserved.