对于下面给定的类,为什么事务范围与调用方法相同?为什么它只在我打电话时起作用,例如来自另一个类的someBeanInstance.A()
?
@Stateless
public class X {
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void A() {
B();
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
//or @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void B() {
// here the transaction is the same
// the annotation has no effect
}
}