title: How to implement a callback when entity is persisted?
body: <p>I have a very simple entity, as: </p>
  
  <pre><code>@Entity
  public class entityA {
  
      @Id
      @GeneratedValue(strategy = GenerationType.TABLE)
      private Long id;
  
      public entityA(){}
  
  }
  </code></pre>
  
  <p>As far as I understood the value <code>id</code> is only set if the entity is persisted. Is this correct?</p>
  
  <p>Since I want to propagate the value of the <code>id</code> to some observers, this only makes sense after the item is persisted. So I need some kind of callback (something like <code>void onPersit()</code>) in <code>entityA</code>. The method <code>entityA.onPersit()</code> shall be automatically be executed if the entity is persisted. How to implement this?</p>
  
  <p>(How) can an entity determin it's own status. E.g. is there some kind of <code>this.isPersisted()</code> or <code>this.isDetached()</code>?</p>