问题描述
一个名为的EJB方法Aby
调用另一个名为的EJB方法Bob
An EJB method named Aby
calls another EJB method named Bob
Bob
标有 @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
a)当 bob
调用结束
b)当 aby
调用结束
c)其他。何时?
推荐答案
我认为A是对的。当方法Bob被调用时,它为它创建新的事务,并且方法Aby被暂停,直到Bob事务被提交。
I think A is right. When the method Bob is being called, it creates new transaction for it and method Aby gets suspended until the Bob transaction is committed.
还要注意,它必须是一些其他的bean使它成为事务,从同一个bean调用的方法不能作为一种业务方法。
Also note that it has to be method from some other bean to make it transactional, methods called from the same bean do not act as a business methods.
看到这个伟大的进一步解释。
See this great article for further explanation.
这篇关于@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)何时提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!