Hibernate, alter identifier/primary key
- by Schildmeijer
I receive the following exception when Im trying to alter my @ID in an @Entity.
identifier of an instance of com.google.search.pagerank.ItemEntity was altered from 1 to 2.
I know that im altering the primary key in my table. Im using JPA-annotations.
I solved this by using this single HQL query: update Table set name=:newName where name=:oldName
instead of using the more oo approach:
beginTransaction();
T e = session.load(...);
e.setName(newName);
session.saveOrUdate(e);
commit();
Any idea what the diff is?