HibernateOptimisticLockingFailureException while updating an object
I am getting following exception while updating an object.

HibernateOptimisticLockingFailureException: Object of class [User] with identifier [25614]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [User#25614]


Situation :- Reason why i am facing this error is that I have a form where users are displayed and I have two buttons there one for updating the password and one for editing the detail of the users. when I click on updating the password then it just query the object and updates its password and keep the object in hibernate session. And then I click on edit button and modify the information and then save it then it gives upper mentioned exception because the object, that I am trying to save, is not hibernate session object but an object with same identifier was queried  by hibernate while updating the password. Now I have two objects with same identifier one is in hibernate session and another is not persisted (not deattached object) yet. I want to update save the changes from not persisted object into the database but because there is an object with same identifier is in hibernate session so hibernate gives an exception.

How I can merge merge changes from not persisted objects to persisted one?

Thanks,
Mukesh
HibernateOptimisticLockingFailureException while updating an object
===

I am getting following exception while updating an object.

HibernateOptimisticLockingFailureException: Object of class [User] with identifier [25614]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [User#25614]


Situation :- Reason why i am facing this error is that I have a form where users are displayed and I have two buttons there one for updating the password and one for editing the detail of the users. when I click on updating the password then it just query the object and updates its password and keep the object in hibernate session. And then I click on edit button and modify the information and then save it then it gives upper mentioned exception because the object, that I am trying to save, is not hibernate session object but an object with same identifier was queried  by hibernate while updating the password. Now I have two objects with same identifier one is in hibernate session and another is not persisted (not deattached object) yet. I want to update save the changes from not persisted object into the database but because there is an object with same identifier is in hibernate session so hibernate gives an exception.

How I can merge merge changes from not persisted objects to persisted one?

Thanks,
Mukesh