You got the set the key value for the newly created object. For example:
Then Hibernate will be able to identify that this object is already existing object and it just has to update the object. Else if there's no key or the key doesn't exist in DB, merge() will save it as a new object.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop