-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Interceptors / event listeners and audit trail
PostPosted: Thu Jul 13, 2006 11:02 am 
Newbie

Joined: Wed Apr 26, 2006 11:39 am
Posts: 8
Location: bracknell, UK
What I want to do: an insert, update or delete occurs for items I've marked with (my own) annotation @Auditable, and hibernate intercepts this and inserts, as part of the same transaction, an entry in the audit table.

Problems:
  1. which is more suited, Interceptor or event listeners?
  2. how can I dig back from an interceptor to find its session, since I want to do session.save()?
  3. alternatively, I know I can get the session from some of the event listeners, is it legit to actually use that session to do inserts from inside an event handler?
  4. If I do the above, will I be inserting into the same transaction as the one in which I did the session.save(auditable) ?
  5. What's the distinction between PersistEventListener and SaveOrUpdateEventListener? How can I tell an insert from an update in event listeners?


Could anyone please help me out with these? The reference docs on this area of Hibernate are a tad sparse.


Top
 Profile  
 
 Post subject: Re: Interceptors / event listeners and audit trail
PostPosted: Sun Nov 21, 2010 5:16 pm 
Newbie

Joined: Tue May 18, 2010 5:39 am
Posts: 19
I wrote an article around this at http://anshuiitk.blogspot.com/2010/11/h ... event.html . But I think you need envers (auditing framework) and not Interceptors or listeners.

_________________
AG
http://anshuiitk.blogspot.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.