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