If a user can change their userName, then userName is not really a primary key for the user entity. You should use a different field that won't change, like an ID or emailAddress as the primary key.
The trouble with changing the primary key in a database is if you have other tables that reference the User table using the primary key, then those references are no longer valid. You would not only have to update the UserName column in the User table but also every other table that links to it. In JPA, the EntityManager would cache your entities by primary key, so changing that would create all sorts of issues, not to mention if you had a 2nd level cache as well. Everything would suddenly get so much harder and break if you were allowed to change an @Id column. -- View this message in context: http://openjpa.208410.n2.nabble.com/Change-value-of-primary-key-field-tp7580285p7580297.html Sent from the OpenJPA Users mailing list archive at Nabble.com.