How does UserTransaction propagate?

前端 未结 3 712
小鲜肉
小鲜肉 2020-12-08 16:11

I have a stateless bean with bean-managed transactions, and a method like this:

@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public clas         


        
3条回答
  •  再見小時候
    2020-12-08 17:04

    For EJB3 you normally define transaction propagation with the @TransactionAttribute annotation.

    The default transaction attribute for all EJB 3.0 applications is REQUIRED:

    If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context.

    The doc's for transaction type are here: http://download.oracle.com/javaee/6/api/javax/ejb/TransactionAttributeType.html

    N.B. Persistence context and transaction propagation typically happen together but not always - beware. For example, stateful session beans may have an extended persistence context.

提交回复
热议问题