Using the EntityManager beta1 I saw that the @PreUpdate callback is not called when the entity is updated.
To showcase that here is a Test case for the EntityManager TestSuite.
replace the testEntityListener method on CallbacksTest with the following code:
Code:
public void testEntityListener() throws Exception {
EntityManager em = factory.createEntityManager();
Cat c = new Cat();
c.setName("Kitty");
c.setDateOfBirth( new Date(90, 11, 15) );
em.getTransaction().begin();
em.persist(c);
em.getTransaction().commit();
em.getTransaction().begin();
c = em.find( Cat.class, c.getId() );
assertNotNull( c.getLastUpdate());
Date date1=c.getLastUpdate();
c.setName("new name!");
em.getTransaction().commit();
em.getTransaction().begin();
c = em.find( Cat.class, c.getId() );
assertNotNull( c.getLastUpdate() );
Date date2=c.getLastUpdate();
if( date1.equals(date2) )
fail("Should not be equal.");
em.getTransaction().commit();
em.close();
}