When does @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) commit?

后端 未结 2 1278
孤独总比滥情好
孤独总比滥情好 2020-12-23 17:00

An EJB method named Aby calls another EJB method named Bob

Bob is marked with @TransactionAttribute(TransactionAttributeT

2条回答
  •  猫巷女王i
    2020-12-23 17:50

    Actually, I think alternative a is correct. See:

    EJB 3.0 - Nested Transaction != Requires New?

    I have also done some research and looked into the db (Hyper Sonic) logs to actually see when it is committed in the db and it is committed when the REQUIRES_NEW method is finished. But since it's up to the container to handle the transactions maybe it could change depending on container. I've used JBoss while debugging this. And Hibernate (worth mentioning since I've tested this by checking db logs). I presume that a database write is involved since you ask about transactions.

    My thoughts differs from the previous answer so it would be fun to be persuaded.

提交回复
热议问题