Originally posted by Madhuri Ramanathan:
Merge() does work (thanks for the idea), except in my case, if I set up my pojo with version optimistic locking strategy, I now get a HibernateOptimisticLockingFailureException. See exception stack trace below. I wonder if in this type of use-case, the right approach is to read the object from the DB and then employ some form of a copy-into the object that is being held by the session before I save it.
Have others encountered similar usages and how have you dealt with the issues around the detached object saving?
org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [Pojo] with identifier [1455148::1]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [Pojo#1455148::1]
[ June 16, 2008: Message edited by: Madhuri Ramanathan ]