Hallo, ich habe folgendes Problem:
Ich habe 2 Klassen “Oberklasse” und “Unterklasse”:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Oberklasse implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
//...
}
@Entity
public class Unterklasse extends Oberklasse implements Serializable {
private static final long serialVersionUID = 1L;
//...
}
Unterklasse benötigt meiner Meinung nach keinen eigenen PrimaryKey, da dieser ja von Oberklasse geerbt wird. Jetzt meckert aber mein Glassfish 3.1.2.2 folgendes:
Exception Description: Predeployment of PersistenceUnit [FundraisingManagerPU] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class Unterklasse] 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.
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [FundraisingManagerPU] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class Unterklasse] 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.
Ich hoffe, mir kann da jemand helfen…stehe irgendwie voll auf dem Schlauch…