title: Effective Entity Update In Hibernate?
body: <p>How can I update an entity "effectively" in hibernate just as by using SQL. </p>
  
  <p>For example : I have a Product entity, which has a field name <code>createTime</code>. When I use <code>session.saveOrUpdate(product)</code> I have to get this field from database and then set to product then update, actually whenever I use <code>session.saveOrUpdate()</code>, I updated ALL fields, even if I need to update only one field. But most of time the value object we passed to DAO layer can't contain all fields information, like the <code>createDate</code> in Product, we seldom need to update this field.</p>
  
  <p>How to just update selected fields? Of course I can use HQL, but that will separate save and update logic .</p>
  
  <p>It would be better If Hibernate has a method like this :</p>
  
  <pre><code>session.updateOnlyNotNullFields(product);
  </code></pre>
  
  <p>How can I do this in Hibernate ?</p>