File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes JTA TransactionManager Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JTA TransactionManager Question" Watch "JTA TransactionManager Question" New topic
Author

JTA TransactionManager Question

Bob Ciazoratione
Greenhorn

Joined: Mar 30, 2005
Posts: 8
Hello,

I have a J2EE application consisting of a Session Facade calling different SLSBs. All the SLSBs which are called by the same thread (= from within the same Session Facade method) should share one object without passing this object explicitly as parameter. The Thread-Local Session pattern is used allowing this object to be shared allong all SLSBs called within the same Thread. This works fine...
Now, when the thread finishes (response is send to the client), the shared object should be cleaned. The thread finishes when the session facade method returns (= when the transaction is committed or rollbacked). In order to clean the shared object when the transaction is commited or rollbacked, the shared object implements the javax.transaction.Synchronization interface and specifies the beforeCompletion() and afterCompletion() methods which contain the clean-up code. When the object-to-share is registered in the Thread-Local, it should also be registered to the TransactionManager. I use the following util class for this:



As you can see, the TransationManager, retrieved from the JNDI context is cached. I have some questions concerning these code:
- Is it possible to cache the TransactionManager retrieved from the JNDI context as above? Is there only one UserTransaction transaction manager within each EJB-JAR module?
- If an EJB-JAR module communicates with different DB schemas, is there still only on TransactionManager that can be cached or should I cache them in a Map with their DataSource?
- Is there any advanced documentation covering this concept?

Note: I use Oracle 9i DB and Oracle 10G App Server...

Thanx In advance, Mates...

Stijn
 
GeeCON Prague 2014
 
subject: JTA TransactionManager Question