Thanks. What I wanted to avoid was the repetition of the following code in every DAO method to open & close the session and do the transaction management.
Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
...
tx.commit();
}
catch (RuntimeException e) {
if (tx != null) tx.rollback();
throw e; // or display error message
}
finally {
sess.close();
}
jhuntley wrote:
You don't need spring to use hibernate. You can use Hibernate quite easily on it's own and integrate it into most SOAs:
http://docs.jboss.org/hibernate/core/4. ... ew-minimalThe manual is actually quite informative and thorough:
http://docs.jboss.org/hibernate/core/4. ... n-US/html/I do recommend researching annotations over XML for setting up ORMs.