We are going to devleop a project, in J2ee, in that we are using DAO pattern,
we are using session beans for EJB and DAO class for Data Access,
So in that case where i have to implement Transactions, in session bean or
in DAO , pls reply with an ideal exampl, it is important.
-
Where to put Transactions? (3 messages)
- Posted by: raguvaran nan
- Posted on: December 18 2004 00:22 EST
Threaded Messages (3)
- Where to put Transactions? by Jeff Drost on December 20 2004 13:47 EST
- Where to put Transactions? by Martin Straus on December 21 2004 13:07 EST
- Where to put Transactions? by Kris Huggins on December 22 2004 10:00 EST
-
Where to put Transactions?[ Go to top ]
- Posted by: Jeff Drost
- Posted on: December 20 2004 13:47 EST
- in response to raguvaran nan
As a rule of thumb, I would put all transaction demarcation at one layer, and that layer should be at as high a level as is possible. This prevents lower levels (DAOs) from needing to make assumptions about the how they are being called - allowing them to be grouped into larger transactions in the future.
Unless I have a good reason not to, I generally tend to use container managed transaction demarcation (CMT) and specify each session bean method as "Required". -
Where to put Transactions?[ Go to top ]
- Posted by: Martin Straus
- Posted on: December 21 2004 13:07 EST
- in response to Jeff Drost
As a rule of thumb, I would put all transaction demarcation at one layer, and that layer should be at as high a level as is possible.
+1
In case you have to use user-defined transactions, you should put this behavior in the entry point to each process, so that each process/service is contained in a single transaction.
Regards,
Martin -
Where to put Transactions?[ Go to top ]
- Posted by: Kris Huggins
- Posted on: December 22 2004 10:00 EST
- in response to raguvaran nan
What are you using EJB for if not transaction management?
The EJB which is your entry point from outside of the container (usually a SLSB using the session facade pattern) should manager you transaction whether explicity or automatically. DAOs should be passed connections and should not do any transaction control.