users@glassfish.java.net

Re: JPA in JSE updating entities

From: <glassfish_at_javadesktop.org>
Date: Thu, 17 Jan 2008 09:35:26 PST

In the JPA specification section 2.1.4, the last two sentences confirm the primary key should not be updated.

"The application must not change the value of the primary key. The behavior is undefined if this occurs."

And the footnotes say an implementation may throw an exception, but it is not a requirement.

After reading this, I remembered that I had done something different with the entity, where I had a temporary object that was being updated before it was being persisted. So, I wasn't actually making the changes to the underlying database, I was making changes in the view on the temporary object.
[Message sent by forum member 'martin_woolstenhulme' (martin_woolstenhulme)]

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