Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.2.4.sp1
Code between sessionFactory.openSession() and session.close():[session.beginTransaction().begin(); ...
...
...session.beginTransaction().commit();
}catch(HibernateException hex){
hex.printStackTrace();
session.beginTransaction().rollback();
}finally{
if(session!=null){
HibernateUtil.releaseSession(session);
}/b]
[b]Name and version of the database you are using:SQL Server 2005
Problems with Session and transaction handling? Yes
Hi,
Im a newbie at using hibernate and wanted clarification for the following:
Can we use session.beginTransaction().commit() and session.beginTransaction().rollback() or do we need to do the following
Transaction tx = session.getTransaction();
tx.begin(); ....
....
tx.commit();
catch(Exception e){
tx.rollback();
}
Pls let me know whether it is legal & correct to use session.beginTransaction().commit() / rollback() as it seems to work without any exceptions.
thanks in advance.