Hi!
I have to use merge() instead of saveOrUpdate() because I've got a NonUniqueObjectException in one of my classes. My problem is that, the merge () did the update well in the database but after the second GET from the webserver I got back the old value of the changed property. Do another GET (refresh, etc.) I got the new value.
Is there any reason of this? Is there any method to refresh the object? I try session.refresh(obj) but it didn't help. My session code is the following:
Code:
Session s = HibernateUtil.getSession();
Transaction tx = s.beginTransaction();
f.setFePasswd(f.getNpasswd1());
try
{
s.saveOrUpdate(f);
} catch (NonUniqueObjectException nu1)
{
s.merge(f);
}
s.flush();
tx.commit();
HibernateUtil.closeSession();
Hibernate version 3.0.5.
Thanks for answer!