Hibernate version: 3.1 Beta
Name and version of the database you are using: MySQL
Hi all,
I want to implement a method that roolback a hibernate transaction when I want...
What can I do to do this?
I try to use the session.getTransaction().rollback() method. But it does not work.
Code:
public class HibernateDataAccessObject extends HibernateDaoSupport implements IDataAccessObject {
public void rollback() {
// (1)
this.getSession(true).getTransaction().rollback();
// (2)
this.getHibernateTemplate().getSessionFactory().getCurrentSession().getTransaction().rollback();
}
The (1) do this :
org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started
org.hibernate.TransactionException: Transaction not successfully started
and the (2), this :
org.hibernate.HibernateException: No TransactionManagerLookup specified
I don't know what can I do...
Thank you...