This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Transaction and non-transaction in Hibernate DAO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Transaction and non-transaction in Hibernate DAO " Watch "Transaction and non-transaction in Hibernate DAO " New topic
Author

Transaction and non-transaction in Hibernate DAO

Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All,
I am developing web java application with help of Hibernate ,



To interact with DB , some cases I need only a single operation and in some cases I need a transaction (multiple operations)
currently I have the following DAO which works only for a single operation but it fails in case of transaction because am commiting the transaction in DAO

is there any way to modify the DAO code so that it can work in both cases (transation and non transaction cases) and what is the best way to do that so it suits all the cases.





AbstractDao.java





UserDAO
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Transaction and non-transaction in Hibernate DAO
 
Similar Threads
Why cant i overload a method using an arryalist as the parameter?
type casting
Hibernate problem
Multiple level logic:iterate
LazyInitializationException [spring + struts2]