title: Can I configure Hibernate/JPA to update an entity record when only non-timestamp fields have been modified?
body: <p>At the moment I have an Hibernate entity class as follows:</p>
  
  <pre><code>@Entity
  @Table(name = "entity")
  public class Entity implements Serializable {
  
      private static final long serialVersionUID = 2040757598327793105L;
  
      @Id
      @Column
      private int id;
  
      @Column
      private String data;    
  
      @Column(name = "last_modified")
      @Temporal(TemporalType.TIMESTAMP)
      private Date lastModified;
  }
  </code></pre>
  
  <p>I've found that even when the non-timestamp fields are not modified (i.e. the <code>data</code> field) a call to <code>merge</code> still updates the timestamp. I would like the timestamp to only update when other data fields have changed.</p>
  
  <p>Is there anyway I can prevent calls to <code>merge</code> making a SQL <code>UPDATE</code> when all other data fields are not modified, or do I have to explicitly check for this myself in the code?</p>