-->
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: Intercepting starting a transaction with Hibernate + JBoss
PostPosted: Tue Oct 25, 2005 11:27 am 
Newbie

Joined: Wed May 19, 2004 3:50 am
Posts: 11
Hi,

I am using the latest JBoss 4.0.3 final release with Hibernate 3.1 beta 3 embedded in my application. We use EJB3 session beans and I am using CMT with getCurrentSession().

I need to intercept the start of each database transaction and execute a stored-procedure call. I need to do this only when a new database transaction has been started.

The only interception mechanism I can see in Hibernate that would help is Interceptor.afterTransactionBegin(). However, this is never called when used with CMT (as the transaction already exists before the Session is created).

Possibly I could achieve this is by a CurrentSessionContext implementation, but I can't see any way to set this when Hibernate is used from inside JBoss.

The JTA API itself seems pretty unhelpful to me in this respect. I can intercept the completion of a transaction but not the start.

Can anyone help?

Many thanks,


Tom.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 10:23 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
You should intercept this on the EJB3 session beans level, since they are the one responsable for starting the transaction on transactional methods.

You can use Interceptor with @AroundInvoke method which starts and stops transaction.


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.