-
Transactions (2 messages)
- Posted by: ravi rao
- Posted on: September 29 2007 12:31 EDT
Hello all, Scenario-1 SLSB1 - m1() calls SLSB2 - m2(). Both these methods use Hibernate to make calls to the Database. Scenario-2 SFSB1 - m1() calls SLSB2 - m2(). Both these methods use Hibernate to make calls to the Database. Whats the best way to handle transactions in these 2 scenarios? m1() and m2() use their own hibernate sessions to set and get data. I want m2() to run within the transaction context of m1(). Replies appreciated ! ThanksThreaded Messages (2)
- Rely on EJB CMT by Tarun Arora on September 30 2007 12:35 EDT
- Wrap your session and transaction by Arseniy Taradonov on February 15 2009 04:23 EST
-
Rely on EJB CMT[ Go to top ]
- Posted by: Tarun Arora
- Posted on: September 30 2007 12:35 EDT
- in response to ravi rao
I wud suggest you to demarcate your transactions through EJB CMT and do not rely on Hibernate for managing ur transactions in both the cases. You wud be using JTA to manage ur transactions. You can do this in ejb-jar.xml. Let me know is this gives u enough hint to move forward or u need more help. Thanks -
Wrap your session and transaction[ Go to top ]
- Posted by: Arseniy Taradonov
- Posted on: February 15 2009 04:23 EST
- in response to ravi rao
You can use commands to wrap the resources like sessions and transactions. Read at the http://fishbolt.org/java/org.fishbolt.common/doc/article.en.html#CommandPattern. The fishbolt (http://fishbolt.org) projects also have a hibernate specific implementation at the http://fishbolt.org/java/org.fishbolt.hibernate/doc/description.en.html (details you can read at the http://fishbolt.org/java/org.fishbolt.hibernate/doc/article.en.html#Architecture.