• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Transaction Context in Stateful Session Bean

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The bean provider must not use javax.ejb.SessionContext.getRollbackOnly() and javax.ejb.SessionContext.setRollbackOnly() in the callbacks ejbRemove, ejbCreate, ejbPassivate and ejbActivate because there is no tx context, rigth?
So, why is it possible to use ejb.SessionContext.getUserTransaction and its methods in this callbacks ?
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vinicius Boson:
Hi,

The bean provider must not use javax.ejb.SessionContext.getRollbackOnly() and javax.ejb.SessionContext.setRollbackOnly() in the callbacks ejbRemove, ejbCreate, ejbPassivate and ejbActivate because there is no tx context, rigth?
So, why is it possible to use ejb.SessionContext.getUserTransaction and its methods in this callbacks ?




I'm not sure about my answer but I'll give it a go: while with CMT is the container which manages the transaction based on the DD and the client's transactional status, with BMT is the developer who starts and ends transactions. When the container is involved, it lets clients to deal with transaction-related methods in a 'meaningful transaction context'. In ejbRemove, the container is about to put the bean in a 'does not exist' state, therefore where is the 'mtc'? With activation/passivation we know that a bean cannot be passivated while in the middle of a transaction therefore activation/passivation and CMT don't get on very well...With the create method, the container has only create an EJB[Local]object, waiting for a business method to be invoked on it, therefore also here I can't see any 'mtc'.

Hope to have said at least (*one*) thing right.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think yo'r absolutely right, Marc

Severin
reply
    Bookmark Topic Watch Topic
  • New Topic