title: How can I trigger actions in my JPA mapped classes whenever they are saved to the database?
body: <p>I want to have a function in one of my JPA annotated classes that is called every time the EntityManager saves them to the database (aka event listener). Is that possible? Preferably, I'd like to distinguish whether it is just about to be saved or has just been saved.</p>
  
  <p>To accomplish what I want, this time I could probably work around with a setter method, but it wouldn't be quite the same.</p>