-->
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.  [ 3 posts ] 
Author Message
 Post subject: Interceptor save()? Please assist.
PostPosted: Fri Jul 14, 2006 6:53 am 
Newbie

Joined: Wed Apr 26, 2006 11:39 am
Posts: 8
Location: bracknell, UK
I want to session.save() an audit log from within an Interceptor. I 'd like to do this inside the same transaction so that the event intercepted and the audit trail are committed or rolled back as a unit.

Is this doable?

If not with interceptors, can I make it work with event listeners?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 7:33 am 
Regular
Regular

Joined: Tue May 16, 2006 3:32 am
Posts: 117
See if the following link helps :-

http://www.hibernate.org/318.html


Top
 Profile  
 
 Post subject: another fix?
PostPosted: Fri Jul 14, 2006 7:42 am 
Newbie

Joined: Wed Apr 26, 2006 11:39 am
Posts: 8
Location: bracknell, UK
On digging back into the previous forum messages, it also seems to be possible to build a transient sub-session from within an interceptor by doing tempSession = sessionFactory.openSession(mainSession.connection()); and remembering to manually tempSession.flush().

Supposedly this should put data into the same transaction but avoid stomping all over the non-threadsafe Session.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.