title: Hibernate: Dirty Checking and Only Update of Dirty Attributes?
body: <p>In the "good old JDBC days" I wrote a lot of SQL code that did very targeted updates of only the "attributes/members" that were actually changed:</p>
  
  <p>For example, consider an object with the following members:</p>
  
  <pre><code>public String name;
  public String address;
  public Date date;
  </code></pre>
  
  <p>If only <code>date</code> was changed in some Business Method I would only issue an SQL <code>UPDATE</code> for the <code>date</code> member.</p>
  
  <p>It seems however (that's my "impression" of Hibernate) that when working with a standard Hibernate mapping (mapping the full class), even updates of only a single member lead to a full update of the object in the SQL statements generated by Hibernate.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Is this observation correct, that Hibernate <em>does not</em> intelligently check (in a fully mapped class), what member(s) where changed and then only issue updates for the specific changed members, but rather always will update (in the generated SQL Update Statement) all mapped members (of a class), even if they were not changed (in case the object is dirty due to one member being dirty...)</p></li>
  <li><p>What can I do to make Hibernate only update those members, that have been changed? I am searching for a solution to have Hibernate only update the member that actually changed.</p></li>
  </ol>
  
  <p>(I know Hibernate does quite some work on dirty-checking, but as far as I know this dirty checking is only relevant to identify if the object as whole is dirty, not what single member is dirty.)</p>