In some specific cases, I would like to control the transaction boundary. For example, I tried
@Stateless
publis class MyLogicBean implements MyLogic {
public void f1WithTx() {...}
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void f2NoTx() {...}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void f3WithTx() {...}
}
When in another session bean that I called
f1WithTx();
f2NoTx() ;
f3WithTx();
unfortunately, the f3WithTx() did throw exception, complaining about no session or session is closed.
Is this the right way to control transaction boundary? What is the best practice?
Thanks in advance.
-Zihong