org.hibernate.test.interceptor
Class StatefulInterceptor
java.lang.Object
org.hibernate.EmptyInterceptor
org.hibernate.test.interceptor.StatefulInterceptor
- All Implemented Interfaces:
- Serializable, Interceptor
public class StatefulInterceptor
- extends EmptyInterceptor
- See Also:
- Serialized Form
Method Summary |
boolean |
onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
Called when an object is detected to be dirty, during a flush. |
boolean |
onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types)
Called before an object is saved. |
void |
postFlush(Iterator entities)
Called after a flush that actually ends in execution of the SQL statements required to synchronize
in-memory state with the database. |
void |
setSession(Session s)
|
Methods inherited from class org.hibernate.EmptyInterceptor |
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, findDirty, getEntity, getEntityName, instantiate, isTransient, onCollectionRecreate, onCollectionRemove, onCollectionUpdate, onDelete, onLoad, onPrepareStatement, preFlush |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatefulInterceptor
public StatefulInterceptor()
onSave
public boolean onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types)
- Description copied from interface:
Interceptor
- 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.
- Specified by:
onSave
in interface Interceptor
- Overrides:
onSave
in class EmptyInterceptor
- Returns:
- true if the user modified the state in any way.
onFlushDirty
public boolean onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types)
- Description copied from interface:
Interceptor
- 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.
- Specified by:
onFlushDirty
in interface Interceptor
- Overrides:
onFlushDirty
in class EmptyInterceptor
- Returns:
- true if the user modified the currentState in any way.
postFlush
public void postFlush(Iterator entities)
- Description copied from interface:
Interceptor
- Called after a flush that actually ends in execution of the SQL statements required to synchronize
in-memory state with the database.
- Specified by:
postFlush
in interface Interceptor
- Overrides:
postFlush
in class EmptyInterceptor
setSession
public void setSession(Session s)
Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.