Tuesday 7 October 2014

When to use Hibernate Merge

Whenever you are working on the same database row referred by two hibernate objects you are bound to get NonUniqueObjectException.

To avoid this one needs to merge the two referenced objects.

One way which is not good is two make the detached object to reference to null.

A good blog to read about merge is -
http://www.stevideter.com/2008/12/07/saveorupdate-versus-merge-in-hibernate/
NonUniqueObjectException
NonUniqueObjectException