users@glassfish.java.net

Re: jpa and object duplication/cloning

From: <glassfish_at_javadesktop.org>
Date: Mon, 07 Jan 2008 10:19:58 PST

You have the same problems that you would have merging any detached object, and the issue isn't so much with the IDs.

Properly configured with Cascades and what not, the em.merge(rootObject) should Just Work(tm).

The problem is more related to relationships and keeping those in sync, since those must all be done manually. For example, if the detached object is a parent/child with 3 child instances, and the DB has 4 child instances, you need to specifically em.delete() the removed instance, the JPA merge will not do that for you.

But, you shouldn't be having any issues with IDs.

What issues are you having?
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=252551