SessionBuilder#interceptor(Interceptor), SharedSessionBuilder#interceptor(), org.hibernate.cfg.Configuration#setInterceptor(Interceptor) , EmptyInterceptor
| Modifier and Type | Method and Description |
|---|---|
| public void | afterTransactionBegin(Transaction
The Hibernate transaction facade object tx)Called when a Hibernate transaction is begun via the Hibernate Transaction API. |
| public void | afterTransactionCompletion(Transaction
The Hibernate transaction facade object tx)Called after a transaction is committed or rolled back. |
| public void | beforeTransactionCompletion(Transaction
The Hibernate transaction facade object tx)Called before a transaction is committed (but not before rollback). |
| public int[] | Returns: array of dirty property indices ornull to indicate Hibernate should perform default behaviourThe entity for which to find dirty properties. entity, Serializable The identifier of the entity id, Object[] The current entity state as taken from the entity instance currentState, Object[] The state of the entity when it was last synchronized (generally when it was loaded) previousState, String[] The names of the entity properties. propertyNames, Type[] The types of the entity properties types)Called from flush(). |
| public Object | Returns: a fully initialized entitythe name of the entity entityName, Serializable the instance identifier id)Get a fully loaded entity instance that is cached externally. |
| public String | Returns: the name of the entityan entity instance object)Get the entity name for a persistent or transient instance. |
| public Object | Returns: an instance of the class, or null to choose default behaviourthe name of the entity entityName, EntityMode The type of entity instance to be returned. entityMode, Serializable the identifier of the new instance id)Instantiate the entity class. |
| public Boolean | Returns: Boolean or null to choose default behavioura transient or detached entity entity)Called to distinguish between transient and detached entities. |
| public void | onCollectionRecreate(Object
The collection instance. collection, Serializable The collection key value. key)Called before a collection is (re)created. |
| public void | onCollectionRemove(Object
The collection instance. collection, Serializable The collection key value. key)Called before a collection is deleted. |
| public void | onCollectionUpdate(Object
The collection instance. collection, Serializable The collection key value. key)Called before a collection is updated. |
| public void | |
| public boolean | Returns: true if the user modified the currentState in any way.The entity instance detected as being dirty and being flushed entity, Serializable The identifier of the entity id, Object[] The entity's current state currentState, Object[] The entity's previous (load time) state. previousState, String[] The names of the entity properties propertyNames, Type[] The types of the entity properties types)Called when an object is detected to be dirty, during a flush. |
| public boolean | Returns: true if the user modified the state in any way.The entity instance being loaded entity, Serializable The identifier value being loaded id, Object[] The entity state (which will be pushed into the entity instance) state, String[] The names of the entity properties, corresponding to the state. propertyNames, Type[] The types of the entity properties, corresponding to the state. types)Called just before an object is initialized. |
| public String | Returns: original or modified sqlsql to be prepared sql)
Deprecated
Supply a
Called when sql string is being prepared.
org. instead, if you wish
to inspect and alter SQL statements.
|
| public boolean | Returns: true if the user modified the state in any way.The entity instance whose state is being inserted entity, Serializable The identifier of the entity id, Object[] The state of the entity which will be inserted state, String[] The names of the entity properties. propertyNames, Type[] The types of the entity properties types)Called before an object is saved. |
| public void | |
| public void |
| afterTransactionBegin | back to summary |
|---|---|
| public void afterTransactionBegin(Transaction tx) Called when a Hibernate transaction is begun via the Hibernate Transaction API. Will not be called if transactions are being controlled via some other mechanism (CMT, for example).
| |
| afterTransactionCompletion | back to summary |
|---|---|
| public void afterTransactionCompletion(Transaction tx) Called after a transaction is committed or rolled back.
| |
| beforeTransactionCompletion | back to summary |
|---|---|
| public void beforeTransactionCompletion(Transaction tx) Called before a transaction is committed (but not before rollback).
| |
| findDirty | back to summary |
|---|---|
| public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) Called from flush(). The return value determines whether the entity is updated
| |
| getEntity | back to summary |
|---|---|
| public Object getEntity(String entityName, Serializable id) throws CallbackException Get a fully loaded entity instance that is cached externally.
| |
| getEntityName | back to summary |
|---|---|
| public String getEntityName(Object object) throws CallbackException Get the entity name for a persistent or transient instance.
| |
| instantiate | back to summary |
|---|---|
| public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException Instantiate the entity class. Return null to indicate that Hibernate should use the default constructor of the class. The identifier property of the returned instance should be initialized with the given identifier.
| |
| isTransient | back to summary |
|---|---|
| public Boolean isTransient(Object entity) Called to distinguish between transient and detached entities. The return value determines the state of the entity with respect to the current session.
| |
| onCollectionRecreate | back to summary |
|---|---|
| public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException Called before a collection is (re)created.
| |
| onCollectionRemove | back to summary |
|---|---|
| public void onCollectionRemove(Object collection, Serializable key) throws CallbackException Called before a collection is deleted.
| |
| onCollectionUpdate | back to summary |
|---|---|
| public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException Called before a collection is updated.
| |
| onDelete | back to summary |
|---|---|
| public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException Called before an object is deleted. It is not recommended that the interceptor modify the state.
| |
| onFlushDirty | back to summary |
|---|---|
| public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected currentState, which will be propagated to both the database and the persistent object. Note that not all flushes end in actual synchronization with the database, in which case the new currentState will be propagated to the object, but not necessarily (immediately) to the database. It is strongly recommended that the interceptor not modify the previousState. Note The indexes across the currentState, previousState, propertyNames and types arrays match.
| |
| onLoad | back to summary |
|---|---|
| public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException Called just before an object is initialized. The interceptor may change the state, which will be propagated to the persistent object. Note that when this method is called, entity will be an empty uninitialized instance of the class. Note The indexes across the state, propertyNames and types arrays match.
| |
| onPrepareStatement | back to summary |
|---|---|
| public String onPrepareStatement(String sql)
Deprecated Supply a Called when sql string is being prepared. | |
| onSave | back to summary |
|---|---|
| public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException Called before an object is saved. The interceptor may modify the state, which will be used for the SQL INSERT and propagated to the persistent object.
| |
| postFlush | back to summary |
|---|---|
| public void postFlush(Iterator<E> entities) throws CallbackException Called after a flush that actually ends in execution of the SQL statements required to synchronize in-memory state with the database.
| |
| preFlush | back to summary |
|---|---|
| public void preFlush(Iterator<E> entities) throws CallbackException Called before a flush.
| |