public class AuditInterceptor extends org.hibernate.EmptyInterceptor
Constructor and Description |
---|
AuditInterceptor() |
Modifier and Type | Method and Description |
---|---|
static String |
getUserForCurrentThread()
Get the user for the current thread.
|
boolean |
onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
Called when an object is detected to be dirty, during a flush.
|
boolean |
onSave(Object entity,
Serializable id,
Object[] currentState,
String[] propertyNames,
org.hibernate.type.Type[] types)
Called before an object is saved.
|
static void |
setUserForCurrentThread(String user)
Store the user for the current thread.
|
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, findDirty, getEntity, getEntityName, instantiate, isTransient, onCollectionRecreate, onCollectionRemove, onCollectionUpdate, onDelete, onLoad, onPrepareStatement, postFlush, preFlush
public AuditInterceptor()
public static void setUserForCurrentThread(String user)
user
- Cannot be null or empty.public static String getUserForCurrentThread()
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types)
org.hibernate.Interceptor
onFlushDirty
in interface org.hibernate.Interceptor
onFlushDirty
in class org.hibernate.EmptyInterceptor
public boolean onSave(Object entity, Serializable id, Object[] currentState, String[] propertyNames, org.hibernate.type.Type[] types)
org.hibernate.Interceptor
onSave
in interface org.hibernate.Interceptor
onSave
in class org.hibernate.EmptyInterceptor
Java Examples available from http://www.basilv.com/psd/software Copyright © 2009 by Basil Vandegriend. All Rights Reserved.