次のセットアップでは、メソッド B は (新しい) トランザクションで実行されますか?
メソッド A とメソッド B の 2 つのメソッドを持つ EJB
public class MyEJB implements SessionBean
public void methodA() {
doImportantStuff();
methodB();
doMoreImportantStuff();
}
public void methodB() {
doDatabaseThing();
}
}
EJB はコンテナー管理であり、requires_new トランザクションには methodB があり、required トランザクションにはメソッド A があります。したがって:
<container-transaction id="MethodTransaction_1178709616940">
<method id="MethodElement_1178709616955">
<ejb-name>MyName</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</method>
<method id="MethodElement_1178709616971">
<ejb-name>MyName</ejb-name>
<method-name>methodB</method-name>
</method>
<trans-attribute>RequiresNew</trans-attribute>
</container-transaction>
ここで、別の EJB が EJB メソッド呼び出しで methodA を呼び出します。methodA がトランザクションで実行されるようになりました。methodA からの methodB への後続の呼び出しは、同じトランザクションで実行されますか、それとも新しいトランザクションで実行されますか? (注意してください、これは実際のコードです。メソッド B への明示的な ejb 呼び出しはありません)