Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction propagation from client?

 
Sajid Moinuddin
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
Suppose I have a stateless session bean and a simple java client/servlet. The methods of the bean uses CMT with attribute required.
Now, My question is , is it possible to get a UserTransaction reference from my simple java client and call the methods of the bean from that usertransaction context?
I have seen examples of clients using jndi lookup for user transaction from the container. what does it mean exactly? Is it what I need to do?

please help.
Regards,
Sajid Moinuddin
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I understand ...

Your client transaction could have been initiated through any interface/class. When your client, with a transaction context, calls a CMT bean, the client transaction context propagates to the bean (in case of Supports, Required, Mandatory). And as far as the execution of the bean is concerned, the container is responsible for managing that transaction.

So, I think the client initiated transaction and container initiated transactions are different, and I don't think ejb specs mention any requirement on how the client should initiate his transaction, it could be through any of the available ways.
 
Sajid Moinuddin
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, this is the answer to my question....In the service method of my servlets which is running in the same container/jvm, I can lookup the UserTransaction from the jndi and propagate it. The container is responsible to bind a reference to usertransaction to java:comp/UserTransaction namespace. However, when the transaction is propagated from a simple java client, it's upto the container if it supports distributed transactions or not. But if it does, it has to follow the OMG1.1 protocol. These talks are in j2ee1.3 spec not in ejb spec 2.0. That's why I couldn't find them earlier.
regards,
Sajid
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic