title: Triggers versus JPA Event
body: <p>I'm doing a Web application using Spring 3.1.0.RELEASE, JSF 2.x, JPA 2 with Hibernate Provider, MySql 5.1.x. The application runs on Tomcat 7.X.</p>
  
  <p>In my entities I have some date like last update date:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Column(name = "last_update_date", insertable = false, updatable = false)
  @Temporal(TemporalType.TIMESTAMP)
  private Date lastUpdateDate;
  </code></pre>
  
  <p>For the moment I have a trigger that updates:</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TRIGGER upd_site BEFORE UPDATE ON site
  FOR EACH ROW SET NEW.last_update_date = CURRENT_TIMESTAMP();
  </code></pre>
  
  <p>It works fine, but I just notice that there is some callbacks methods in JPA <a href="http://www.objectdb.com/java/jpa/persistence/event" rel="noreferrer">http://www.objectdb.com/java/jpa/persistence/event</a></p>
  
  <p>What is the best between JPA Events and the MySql's triggers ?</p>
  
  <p>Thanks.</p>