Top Description Fields Constructors Methods
org.hibernate.internal

public final Class EmptyInterceptor

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

An interceptor that does nothing. This is an internal class and should not be used as a base to implement a custom Interceptor; it is similar to the public, deprecated org.hibernate.EmptyInterceptor but overrides the default methods for sake of efficiency: this wasn't possible on the original deprecated copy as that wouldn't have been backwards compatible. For this reason this copy is internal. Implementors of Interceptor don't need a base class anymore since we now have default implementations of the contract defined in the interface.

Field Summary

Modifier and TypeField and Description
public static final Interceptor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int[]
findDirty(Object
The entity for which to find dirty properties.
entity
,
Object
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
)

Overrides default org.hibernate.Interceptor.findDirty.

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

Overrides default org.hibernate.Interceptor.getEntity.

Get a fully loaded entity instance that is cached externally.
public void
onDelete(Object
The entity instance being deleted
entity
,
Object
The identifier of the entity
id
,
Object[]
The state of the entity
state
,
String[]
The names of the entity properties.
propertyNames
,
Type[]
The types of the entity properties
types
)

Overrides default org.hibernate.Interceptor.onDelete.

Called before an object is deleted.
public boolean
onFlushDirty(Object
The entity instance detected as being dirty and being flushed
entity
,
Object
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
)

Overrides default org.hibernate.Interceptor.onFlushDirty.

Called when an object is detected to be dirty, during a flush.
public boolean
onLoad(Object
The entity instance being loaded
entity
,
Object
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
)

Overrides default org.hibernate.Interceptor.onLoad.

Called just before an object is initialized.
public boolean
onSave(Object
The entity instance whose state is being inserted
entity
,
Object
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
)

Overrides default org.hibernate.Interceptor.onSave.

Called before an object is saved.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final Interceptor INSTANCE

Constructor Detail

EmptyInterceptorback to summary
private EmptyInterceptor()

Method Detail

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

Overrides default 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

The entity for which to find dirty properties.

id:Object

The identifier of the entity

currentState:Object[]

The current entity state as taken from the entity instance

previousState:Object[]

The state of the entity when it was last synchronized (generally when it was loaded)

propertyNames:String[]

The names of the entity properties.

types:Type[]

The types of the entity properties

Returns:int[]

array of dirty property indices or null to indicate Hibernate should perform default behaviour

Annotations
@Override
getEntityback to summary
public Object getEntity(String entityName, Object id)

Overrides default 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:Object

the instance identifier

Returns:Object

a fully initialized entity

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

Overrides default 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.

Parameters
entity:Object

The entity instance being deleted

id:Object

The identifier of the entity

state:Object[]

The state of the entity

propertyNames:String[]

The names of the entity properties.

types:Type[]

The types of the entity properties

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

Overrides default 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.

Parameters
entity:Object

The entity instance detected as being dirty and being flushed

id:Object

The identifier of the entity

currentState:Object[]

The entity's current state

previousState:Object[]

The entity's previous (load time) state.

propertyNames:String[]

The names of the entity properties

types:Type[]

The types of the entity properties

Returns:boolean

true if the user modified the currentState in any way.

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

Overrides default 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.

Parameters
entity:Object

The entity instance being loaded

id:Object

The identifier value being loaded

state:Object[]

The entity state (which will be pushed into the entity instance)

propertyNames:String[]

The names of the entity properties, corresponding to the state.

types:Type[]

The types of the entity properties, corresponding to the state.

Returns:boolean

true if the user modified the state in any way.

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

Overrides default 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.

Parameters
entity:Object

The entity instance whose state is being inserted

id:Object

The identifier of the entity

state:Object[]

The state of the entity which will be inserted

propertyNames:String[]

The names of the entity properties.

types:Type[]

The types of the entity properties

Returns:boolean

true if the user modified the state in any way.

Annotations
@Override