Hi,
I have to analyze and improve a pretty complex web application which sometimes has unexpected behaviour...
Sometimes code looks like this :
Transaction transaction = session.beginTransaction(); // jdbc transaction
try{
...
session.save(object);
transaction.commit(); // commit 1
...
session.save(object2);
transaction.commit(); // commit 2
}
catch (Exception e)
{
if (transaction != null)
try
{
transaction.rollback();
}
catch (HibernateException e1)
{
}
...
}
So, as you con see, several commit are made on same transaction, with possibly one rollback at the end.
Can someone tell me how Hibernate/JDBC behave to this? Is the rollback abort all the transaction or just from the last succeeded transaction commit? Is this way of using transactions is to blamed?
Thank you for any answer.
Manu
|