wood burning stoves*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes TX mgmt responsibility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "TX mgmt responsibility" Watch "TX mgmt responsibility" New topic
Author

TX mgmt responsibility

Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
CMT or BMT, it's responsibility of container provider & server provider to handle TX management.


BMT works like following,
@Resource
UserTX tx;
tx.begin()
tx.commit()
tx.rollBack()

It's bean which is handling Tx, can someone please help to understand above statement.
Bod Toki
Ranch Hand

Joined: Sep 01, 2006
Posts: 95
When you use the UserTransaction API, you're using a high level transaction API that manages all sorts of transactional resources under the hood. Probably what the statement is attempting to say is that it is the responsibility of the container/server provider to ensure coordinated transaction management under the hood... so that when the container or bean provider begins, commits, marks for rollback, or rollback a transaction, the appropriate transactional resources are notified and coordinated.

Hope this helps.
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Thanks for reply.

When we work with JDBC we use the same method calls (begin, commit, rollback methods) and that time we assume that it's the application which is managing the Tx.

Second thought is that, Even Tx in BMT can not join existing Tx but in BMT we can still call EJBContext.setRollbackOnly (if method of BMT is called from CMT), and container take care of underlying Tx.

Thanks.
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Second thought is that, Even Tx in BMT can not join existing Tx but in BMT we can still call EJBContext.setRollbackOnly (if method of BMT is called from CMT), and container take care of underlying Tx.

But in BMT Tx is still handled by Bean
and container is playing role for CMT only(for which it was set setRollbackOnly)

Last thing we call it BEAN manage Tx.

CMT or BMT, it's responsibility of container provider & server provider to handle TX management.

Is it correct statement?
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
When we work with JDBC we use the same method calls (begin, commit, rollback methods) and that time we assume that it's the application which is managing the Tx.

There are some more activities, the container does in BMT mode: See core spec 13.6.1
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 view interfaces, the container suspends any transaction that may be associated with the client request. If there is a transaction associated with the instance (this would happen if a stateful session bean instance started the transaction in some previous buiseness method), the container associates the method execution with this transaction. If there are interceptor methods associated with the bean instances, these actions are taken before the interceptor methods are invoked.


CMT or BMT, it's responsibility of container provider & server provider to handle TX management.
I would agree on it.


SCJP 5 (98%) - SCBCD 5 (98%)
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Thanks.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TX mgmt responsibility
 
Similar Threads
Doubt in stateful session bean
Transactions: Mix BMT & CMT
ques from INESystems
Application Exception thrown by Bean with BMT
is getRollBackOnly container callback?