This content has been marked as final. Show 3 replies
you shouldn't need multiple transactions to invoke multiple methods inside a single EJB.
or is your situation that you have multiple EJBs that need to talk to eachother?
yes nukes always start a transaction in a web filter. this
is to ensure
1.usage of CMP 2.x entity beans in the web layer, it always require an active transaction.
2.work coordination and when to flush the value objects interceptors that are in the used in the forums.
3.acidity of course
it is not an old transaction, it is an active transaction.
I think you cannot suspend it with the UserTransaction. The only way you can do that is to use the transaction manager that you get in the JNDI tree and you get the Transaction object. Then you should use :
// call my EJBs
*but* this is the same thing that doing a RequiresNew on you session bean (really it does exactly that).
Why do you need a session bean. Is it not possible to put your logic in the modules ? it has been designed for that, like a session bean but with more (lifecycle, one instance guaranteed per VM, configuration etc...) [and less of course, but we only loose remoteness, security]
I have a somewhat odd question:
I wonder if there is some sort of hidden UserTransaction running in Nukes? The problem is that there seems to be an old transaction whenever I call a session (stateless or stateful) EJB from a nukes module. If I specify "Never" as the transaction attribute for an EJB method, I get an exception from JBoss telling me that transactions are not allowed when I invoke the method from a Nukes module.
I know that I could use "RequiresNew" to create a new transaction or "NotSupported" to by-pass the current transaction, but since the methods in my EJBs have to call each-other recursively this is not a very good solution.
Is there any way to go around this? Could I disable the transaction context provided by Nukes (if any) or could I start a new, clean UserTransaction.
Or am I just talking rubbish? :)
Ok. Thanks for the explanation - that enlightened me somewhat. Now I understand the aproach with an active transaction within the Nukes module. Now I have some options to consider.