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.
|