I am using hibernate and spring for my web application.
In this at some places i forgot to commit transaction…like below code
SessionFactory sf = HibernateUtils.getSessionFactory();
session = sf.openSession();
tx = session.beginTransaction();
..........................................Some Code.............................
But forgot to commit transaction.....
finally
{
session.flush();
session.close();
}
Now My question is that :-
- Is this creates any problem for me ??
- Any issue regarding memory leak ??
- Increasing load to database??
Or what is effect of this on my system ??
If you don’t commit the transaction, then
commit()method is never called on such a connection till it gets closed/dropped, then all the changes made will be lost after close/drop of the connection.Basically, the behavior of your system will be arbitrary which means it’s a problem for you. It doesn’t cause any memory leak though.