openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinbr88 <>
Subject Change value of primary key field
Date Thu, 14 Jun 2012 11:28:23 GMT

I have a table in my database which stores our user data. The first field is
the username which is primary key. I can change the username in the database
without any problem. The primary key is never referenced as foreign key of
an other table. But when I change the username of a persisted object (user)
in my application and merge the new user with his new username, I get this

javax.servlet.ServletException: javax.el.ELException:
<openjpa-2.2.0-r422266:1244990 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException: Attempt to change a
primary key field of an instance that already has a final object id.  Only
new, unflushed instances whose id you have not retrieved can have their
primary keys changed.
FailedObject: jpa.RolloutUser-TEST


I don't understand what this means. Does it mean, that it isn't even
possible changing the value of an primary key field with openJPA? Something
like a security feature?

The only thing I could do imho is deleting the user and create a new one
with the new username. But this is not very smart.

Do you have any suggestion?

Thanks in advance?

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message