users@glassfish.java.net

Re: JPA merge creating new record

From: <glassfish_at_javadesktop.org>
Date: Fri, 06 Jul 2007 16:22:31 PDT

Solution:

After a billion tests with loads of logging statements to follow the values, I found the error. It was my bad. Turns out I had a rogue setter method in my entity bean (I use property access, not field access). A setter for another field was mistakenly setting the id field. So what happened was that the id was changed just before persisting, and then of course the entitymanager saw this as a new entity.

This was probably a copy/paste error.

Thanks for trying to help, guys!

Marius
[Message sent by forum member 'mariusw' (mariusw)]

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