>Using transaction management outside the DAO is not a good idea. It
should be done inside the DAO itself.
Since I did not read a valid answer to this statement, here I am :).
Transaction should NOT be open/closed inside DAO themselves. This is
really a really idea :
- in that case you cannot include several DAO calls into one transaction
(atomicity on several entities CRUD cannot be done). This is more than a
little bit restrictive !
- in a JTA transaction, you may not have the control on the transaction
scope, you may just "participate" to the transaction (see first point)
I think that these only 2 points make it obvious, not to call
transaction begin/commit in the DAOs themselves. Of course, more can be
added. |