Top Description Fields Constructors Methods
org.hibernate

public Class EmptyInterceptor

extends Object
implements Interceptor, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.Interceptor
Imports
java.io.Serializable, java.util.Iterator, org.hibernate.type.Type

An interceptor that does nothing. May be used as a base class for application-defined custom interceptors.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
public static final Interceptor

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
afterTransactionBegin(Transaction tx)

Implements org.hibernate.Interceptor.afterTransactionBegin.

Called when a Hibernate transaction is begun via the Hibernate Transaction API.
public void
afterTransactionCompletion(Transaction tx)

Implements org.hibernate.Interceptor.afterTransactionCompletion.

Called after a transaction is committed or rolled back.
public void
beforeTransactionCompletion(Transaction tx)

Implements org.hibernate.Interceptor.beforeTransactionCompletion.

Called before a transaction is committed (but not before rollback).
public int[]
findDirty(Object
a persistent entity
entity
,
Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.findDirty.

Called from flush().
public Object
getEntity(String
the name of the entity
entityName
,
Serializable
the instance identifier
id
)

Implements org.hibernate.Interceptor.getEntity.

Get a fully loaded entity instance that is cached externally
public String
getEntityName(Object
an entity instance
object
)

Implements org.hibernate.Interceptor.getEntityName.

Get the entity name for a persistent or transient instance
public Object
instantiate(String
the name of the entity
entityName
,
EntityMode
The type of entity instance to be returned.
entityMode
,
Serializable
the identifier of the new instance
id
)

Implements org.hibernate.Interceptor.instantiate.

Instantiate the entity class.
public Boolean
isTransient(Object
a transient or detached entity
entity
)

Implements org.hibernate.Interceptor.isTransient.

Called to distinguish between transient and detached entities.
public void
onCollectionRecreate(Object collection, Serializable key)

Implements org.hibernate.Interceptor.onCollectionRecreate.

Called before a collection is (re)created.
public void
onCollectionRemove(Object collection, Serializable key)

Implements org.hibernate.Interceptor.onCollectionRemove.

Called before a collection is deleted.
public void
onCollectionUpdate(Object collection, Serializable key)

Implements org.hibernate.Interceptor.onCollectionUpdate.

Called before a collection is updated.
public void
onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onDelete.

Called before an object is deleted.
public boolean
onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onFlushDirty.

Called when an object is detected to be dirty, during a flush.
public boolean
onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onLoad.

Called just before an object is initialized.
public String
onPrepareStatement(String
sql to be prepared
sql
)

Implements org.hibernate.Interceptor.onPrepareStatement.

Called when sql string is being prepared.
public boolean
onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onSave.

Called before an object is saved.
public void
postFlush(Iterator<E> entities)

Implements org.hibernate.Interceptor.postFlush.

Called after a flush that actually ends in execution of the SQL statements required to synchronize in-memory state with the database.
public void
preFlush(Iterator<E> entities)

Implements org.hibernate.Interceptor.preFlush.

Called before a flush
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final Interceptor INSTANCE

Constructor Detail

EmptyInterceptorback to summary
protected EmptyInterceptor()

Method Detail

afterTransactionBeginback to summary
public void afterTransactionBegin(Transaction tx)

Implements org.hibernate.Interceptor.afterTransactionBegin.

Doc from org.hibernate.Interceptor.afterTransactionBegin.

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).

afterTransactionCompletionback to summary
public void afterTransactionCompletion(Transaction tx)

Implements org.hibernate.Interceptor.afterTransactionCompletion.

Doc from org.hibernate.Interceptor.afterTransactionCompletion.

Called after a transaction is committed or rolled back.

beforeTransactionCompletionback to summary
public void beforeTransactionCompletion(Transaction tx)

Implements org.hibernate.Interceptor.beforeTransactionCompletion.

Doc from org.hibernate.Interceptor.beforeTransactionCompletion.

Called before a transaction is committed (but not before rollback).

findDirtyback to summary
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.findDirty.

Doc from org.hibernate.Interceptor.findDirty.

Called from flush(). The return value determines whether the entity is updated

  • an array of property indices - the entity is dirty
  • an empty array - the entity is not dirty
  • null - use Hibernate's default dirty-checking algorithm
Parameters
entity:Object

a persistent entity

Returns:int[]

array of dirty property indices or null to choose default behaviour

getEntityback to summary
public Object getEntity(String entityName, Serializable id)

Implements org.hibernate.Interceptor.getEntity.

Doc from org.hibernate.Interceptor.getEntity.

Get a fully loaded entity instance that is cached externally

Parameters
entityName:String

the name of the entity

id:Serializable

the instance identifier

Returns:Object

a fully initialized entity

getEntityNameback to summary
public String getEntityName(Object object)

Implements org.hibernate.Interceptor.getEntityName.

Doc from org.hibernate.Interceptor.getEntityName.

Get the entity name for a persistent or transient instance

Parameters
object:Object

an entity instance

Returns:String

the name of the entity

instantiateback to summary
public Object instantiate(String entityName, EntityMode entityMode, Serializable id)

Implements org.hibernate.Interceptor.instantiate.

Doc from org.hibernate.Interceptor.instantiate.

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.

Parameters
entityName:String

the name of the entity

entityMode:EntityMode

The type of entity instance to be returned.

id:Serializable

the identifier of the new instance

Returns:Object

an instance of the class, or null to choose default behaviour

isTransientback to summary
public Boolean isTransient(Object entity)

Implements org.hibernate.Interceptor.isTransient.

Doc from org.hibernate.Interceptor.isTransient.

Called to distinguish between transient and detached entities. The return value determines the state of the entity with respect to the current session.

  • Boolean.TRUE - the entity is transient
  • Boolean.FALSE - the entity is detached
  • null - Hibernate uses the unsaved-value mapping and other heuristics to determine if the object is unsaved
Parameters
entity:Object

a transient or detached entity

Returns:Boolean

Boolean or null to choose default behaviour

onCollectionRecreateback to summary
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException

Implements org.hibernate.Interceptor.onCollectionRecreate.

Doc from org.hibernate.Interceptor.onCollectionRecreate.

Called before a collection is (re)created.

onCollectionRemoveback to summary
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException

Implements org.hibernate.Interceptor.onCollectionRemove.

Doc from org.hibernate.Interceptor.onCollectionRemove.

Called before a collection is deleted.

onCollectionUpdateback to summary
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException

Implements org.hibernate.Interceptor.onCollectionUpdate.

Doc from org.hibernate.Interceptor.onCollectionUpdate.

Called before a collection is updated.

onDeleteback to summary
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onDelete.

Doc from org.hibernate.Interceptor.onDelete.

Called before an object is deleted. It is not recommended that the interceptor modify the state.

onFlushDirtyback to summary
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onFlushDirty.

Doc from org.hibernate.Interceptor.onFlushDirty.

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.

Returns:boolean

true if the user modified the currentState in any way.

onLoadback to summary
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onLoad.

Doc from org.hibernate.Interceptor.onLoad.

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.

Returns:boolean

true if the user modified the state in any way.

onPrepareStatementback to summary
public String onPrepareStatement(String sql)

Implements org.hibernate.Interceptor.onPrepareStatement.

Doc from org.hibernate.Interceptor.onPrepareStatement.

Called when sql string is being prepared.

Parameters
sql:String

sql to be prepared

Returns:String

original or modified sql

onSaveback to summary
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)

Implements org.hibernate.Interceptor.onSave.

Doc from org.hibernate.Interceptor.onSave.

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.

Returns:boolean

true if the user modified the state in any way.

postFlushback to summary
public void postFlush(Iterator<E> entities)

Implements org.hibernate.Interceptor.postFlush.

Doc from org.hibernate.Interceptor.postFlush.

Called after a flush that actually ends in execution of the SQL statements required to synchronize in-memory state with the database.

preFlushback to summary
public void preFlush(Iterator<E> entities)

Implements org.hibernate.Interceptor.preFlush.

Doc from org.hibernate.Interceptor.preFlush.

Called before a flush