Hi, I am using Hibernate + Spring + JTA in my project. I am using JTA because my project deals with multiple databases. When I use the following:
getHibernateTemplate().save(employee);
JTA works properly in above case and in case of any exception, Transaction is rolled back.
But when I use following transaction is not rolled back.
Session ses =getHibernateTemplate().getSessionFactory().getCurrentSession(); ses.createQuery("update Employee emp set emp.empName='sonu' where emp.empId=1").executeUpdate();
Can anybody please help me in understanding the difference and also help me in knowing the solution.
|