title: @PostLoad in super class
body: <p>I have several Entity classes. Now I want to use @PostLoad in every entity. The function code is for every entity the same. So I made a super class (public abstract class AbstractModel {..}) which contain the @PostLoad method. Now is it possible to do this? In a quick test the method is not executed but the method is executed placed in the entity... Maybe someone has a workaround for this?</p>
  
  <pre><code>@MappedSuperclass
  public class Parent implements Serializable
  {
  
      @PostLoad
      public void postLoad()
      {
          System.out.println("postLoad called!");
      }
  
  
  }
  </code></pre>
  
  <p>My entity class who extends from Parent:</p>
  
  <pre><code>@Entity
  @Table(name = "albums") //de naam van de tabel wordt 'albums'
  public class Album extends Parent implements Serializable
  {
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "id") //de naam van de kolom wordt 'id'
      private Long id;
  
  ...
  }
  </code></pre>
  
  <p>And the error when I'm running it:</p>
  
  <blockquote>
    <p>Exception [EclipseLink-30005] (Eclipse
    Persistence Services -
    2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception
    was thrown while searching for
    persistence archives with ClassLoader:
    sun.misc.Launcher$AppClassLoader@11b86e7</p>
    
    <p>Internal Exception:
    javax.persistence.PersistenceException:
    Exception [EclipseLink-28018] (Eclipse
    Persistence Services -
    2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.EntityManagerSetupException</p>
    
    <p>Exception Description: Predeployment
    of PersistenceUnit [JPA_TestPU]
    failed. </p>
    
    <p>Internal Exception: Exception
    [EclipseLink-7161] (Eclipse
    Persistence Services -
    2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Entity class
    [class jpatest.Album] has no primary
    key specified. It should define either
    an @Id, @EmbeddedId or an @IdClass. If
    you have defined PK using any of these
    annotations then make sure that you do
    not have mixed access-type (both
    fields and properties annotated) in
    your entity class hierarchy.</p>
  </blockquote>