• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Transaction propagation from client?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic