I do not understand the explanation for 5th varian.
==
Since the question specifies that anotherBean.anotherMethod() executes in the same transaction that is started by myMethod(), anotherBean must be a CMT bean because if it were a BMT bean, the transaction started by myMethod() would have been suspended.
==
What is wrong if the transaction started by myMethod() would have been suspended?
If it is suspended, anotherMethod could not rollback it.
About Question enthuware.oce-jpad.v6.2.392 :
Moderator: admin
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.392 :
The problem statement states that the second bean's method executes in the same transaction as the first bean. BMT will not satisfy this part of the problem.
If you like our products and services, please help us by posting your review here.
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.392 :
How would it (the method in BMT bean anotherMethod) have been suspended? I thought that transactions are suspended by the use ofSince the question specifies that anotherBean.anotherMethod() executes in the same transaction that is started by myMethod(), anotherBean must be a CMT bean because if it were a BMT bean, the transaction started by myMethod() would have been suspended.
Code: Select all
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
Code: Select all
@TransactionAttribute
Thanks.The TransactionAttribute annotation specifies whether the container is to invoke a business method within a transaction context. The TransactionAttribute annotation can be used for session beans and message driven beans. It can only be specified if container managed transaction demarcation is used.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.392 :
As per section 13.6.1 of EJB 3.1 Specification:
In the situation given in the question, if the given code calls anotherBean used BMT, the transaction started by this code would have to be suspended.The container must manage client invocations to an enterprise bean instance with bean-managed transaction demarcation as follows. When a client invokes a business method via one of the enterprise bean’s client views, the container suspends any transaction that may be associated with the client request.
If you like our products and services, please help us by posting your review here.
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.392 :
I've just seen this in ProJPA2 which confirms what you're saying:
Thanks.
I think what I need to get my head around is that managing transactions in BMT is not as analagous to managing transactions in Java SE with EntityManager as I have been thinking it was. There is still "container stuff" going on, like here. A transaction is suspended, but not because an annotation was specified, nor because you called some txsuspend() method or other; it's just suspended, because, well, that's just how it works.One penalty of transactions being managed by the application instead of by the container is that they do not get propagated to methods called on another BMT bean. For example, if Bean A begins a transaction and then calls Bean B, which is using bean-managed transactions, then the transaction will not get propagated to the method in Bean B. Any time a transaction is active when a BMT method is invoked, the active transaction will be suspended until control returns to the calling method.
Thanks.
Who is online
Users browsing this forum: No registered users and 20 guests