How do trnsaction types interact
I want call an ejb that performs some stuff not in a db transaction (for speed) and some stuff in a transaction. Would the following work where one ejb calls 2 method in another ejb one which requires a transaction and one does not, or would it all run in one transaction, or is it illegal ?
ejb1.method1( )Transaction Required()
{
ejb2.method1()
ejb2.method2()
}
ejb2.method1() Trnsaction Type None
ejb2.method2() Transaction Type Required
> ejb1.method1( )Transaction Required()
> {
> ejb2.method1()
> ejb2.method2()
> }
>
> ejb2.method1() Trnsaction Type None
> ejb2.method2() Transaction Type Required
Do you mean NotSupported for ejb2.method1()?
AFAIK, the following should work. ejb2.method1() call will not be a part of the transaction.
The container will suspend the transaction context with the current thread and delegate the call to the method with the NotSupported transaction. When the method is completed, the container will resume the transaction.
As per the docs for Required Transaction Attribute as declared for method1 of ejb1, it should pass the Transaction Context to the called bean ejb2's method1 and method2.
Do you mean to say that ejb2's method1 having transaction attribute Never will be executed
a. without any exception ?
or
b. will method1 of ejb2 wont be part of the transaction context?
Rgds,
seetesh