Thread:
 Transaction scope 
 Olivier Billard   14 May 2007, 05:42 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: Olivier Billard (14 May 2007, 05:42) Replies: 0, Views: 4712
Subject: Transaction scope
>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.
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]