About Question enthuware.oce-jpad.v6.2.407 :

Moderator: admin

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.oce-jpad.v6.2.407 :

Post by himaiMinh »

In the last explanation :
If the bean uses Container Managed Transactions, then the exception would be thrown because of sessionContext.getUserTransaction().
But if the bean is CMT, a user transaction can be created and suspends the current active container managed transaction according to table 13 of EJB specification.
Correct me if I am wrong.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.407 :

Post by himaiMinh »

I just found 13.6.2.10 from EJB spec :
If an instance of an enterprise bean with container-managed transaction demarcation attempts to invoke getUserTransaction method of the EJBContext, the container must throw the IllegalStateException
But in table 13, it says the CMT transaction will be suspended when the BMT transaction is started.

Are these two statements conflicting?

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.407 :

Post by himaiMinh »

I think I can answer my own question about table 13.
What table 13 includes is a scenario like this:
1. A CMT bean A is running an active transaction.
2. This bean A calls BMT bean B, which has its own UserTransaction.
3. Bean B suspends bean A's active transaction until B's userTransaction completes.

What section 13.6.2.10 says is if bean A is a CMT, it cannot use EJBContext.getUserTransaction();otherwise, IllegalStateException will be thrown.

So, both statements are not conflicting.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests