history « Interceptor « JPA Q&A





1. Using Interceptor for recording of changes history?    forum.hibernate.org

Hi, What I would like to do is to create backlog of changes by hooking Interceptor onFlushDirty method and saving changes in same transaction as flush happens. Is it possible to save History instance (newly created intsnce which has list of changes recorded) along with changed object using same flush/commit within onFlushDirty method hook? For example: public class HistoryHook implements Interceptor ...

2. Using Interceptor for recording of changes history?    forum.hibernate.org

Hi, I am trying to understand if it would be possible to use iterceptor to track and log history of entity changes. For Example: public class HistoryHook implements Interceptor { private Session cs; public HistoryHook(Session s) { cs=s; } public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { if(entity instanceof HistoryEntry) return false; ...

3. Interceptor to create history / activity records    forum.hibernate.org

As luck would have it, right after the blog post about creating history records went up on "In Relation To..." (http://blog.hibernate.org/cgi-bin/blosxom.cgi/2004/06/19/), we've got a requirement to implement something like this. Unfortunately, database triggers were nixed, so we're left looking at Interceptors or Lifecycle callbacks. I took a look at the History Interceptor article on the wiki (http://www.hibernate.org/195.html), but I'm a little ...