Can you inject a UserTransaction (or look it up) to get the transaction attribute?
Not sure but I would think ejb-jar.xml could be used for setting interceptor precedence.
Are there any Hibernate callbacks/interceptors you could use for the case?
I don't know a way to do surround the Tx in EJB3 with an interceptor, it will always inside the Tx and all other container related stuff.
The problem is that the Tx might be rolled back in case of DB issues (like constraints, optimistic locking, etc) this will happen during the commit phase and not visible inside the bean method because at this state the Tx is still active and valid.
You might do it with a BeanManagedTransaction - lookup UserTransaction and manage it
Or you surround each Bean with another one which is annotated as TX=Never and call your original one (solution from anothe r forum member).
But in both cases you have the drawback that you have to do this for every method where you want this behaviour.
Actually i can inject the UserTransaction event though i believe i am not supposed to do it in CMT bean... but how can i obtain the transaction attribute with it ?
You are right about interceptors precedence in ejb-jar.xml but i believe that i can specify there only my custom interceptors, if not please give me clue ... and i'll search in depth
Actually hibernate interceptors sound like a very good idea,
still ... i want to put the whole invocation (of ejb method) inside a try-catch block so i can catch the exceptions and alter some of them (resend as ApplicationException).
for the moment i have no idea how i might do this in the callbacks (and i haven't managed to make a hibernate callback to work yet ).
What you have stated seems very true, and very discouraging .
My only purpose is to catch the sent exception... so the rollback phase should be passed by that time.
Of course , as you have probably guessed the BMT is not an option in my case.