• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TX mgmt responsibility

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.


 
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic