title: Redundant data in update statements
body: <p>Hibernate generates <code>UPDATE</code> statements, which include all columns, regardless of whether I'm changing the value in that columns, eg:</p>
  
  <pre><code>tx.begin();
  Item i = em.find(Item.class, 12345);
  i.setA("a-value");
  tx.commit();
  </code></pre>
  
  <p>issues this <code>UPDATE</code> statement:</p>
  
  <pre><code>update Item set A = $1, B = $2, C = $3, D = $4 where id = $5
  </code></pre>
  
  <p>So columns <code>B</code>, <code>C</code>, <code>D</code> are updated, while I didn't change them.</p>
  
  <p><strong>Say, Items are updated frequently and all columns are indexed. 
  Does it make sense to optimize the Hibernate part to something like this?</strong></p>
  
  <pre><code>tx.begin();
  em.createQuery("update Item i set i.a = :a where i.id = :id")
      .setParameter("a", "a-value")
      .setParameter("id", 12345)
      .executeUpdate();
  tx.commit();
  </code></pre>
  
  <p>What confuses me most is that the <code>EXPLAIN</code> plans of the 'unoptimized' and the 'optimized' query version are identical!</p>