inheritance « Composite « JPA Q&A





1. How do you implement inheritance with tables that have multi-column/composite primary keys (JPA 1.0 @IdClass)?    stackoverflow.com

Given the following tables:

CREATE TABLE Employees
(
  first_name VARCHAR(50) NOT NULL,
  last_name VARCHAR(50) NOT NULL,
  birth_date DATE NOT NULL,
  PRIMARY KEY (first_name, last_name)
);

CREATE TABLE Managers
(
  first_name VARCHAR(50) ...

2. Composite Key in JPA / Hibernate with inherited class    stackoverflow.com

i have a composite id defined on my class structure as below. Unfortunatly i always get a hibernate error that complains on the not found "part2": "Property of @IdClass not found in ...

3. Composite Foreign Key Issue while using Inheritance in JPA    stackoverflow.com

I have a JPA Entity StatsEntity which has a composite primary key that is also as foreign key to another Entity Roster. This is setup as a @OneToOne relationship using @JoinColumns({@JoinColumn...}) ...

5. Inheritance and composite id mapping problem    forum.hibernate.org

@Entity @Inheritance(strategy=InheritanceType.JOINED) @Table(name="texts") public abstract class Text { @Id @Column(name="text_id", updatable=false, nullable=false) private long id; @OneToMany(orphanRemoval=true, cascade={CascadeType.ALL}, fetch=FetchType.LAZY) @JoinColumn(name="text_id") private List languageTexts = new ArrayList(); String description; protected Text(){} ... ...

6. Inheritance using composite primary keys    forum.hibernate.org

I want to create an inheritance structure by using annotations; the inheritance type is InheritanceType.JOINED. When using an integer as ID in the base entity everything works fine, but when using a composite ID the binding of the concrete entity fails. Does anyone why? The code looks like follows: [code]@Entity @Inheritance(strategy = InheritanceType.JOINED) public class Base implements Serializable { private BasePK ...

8. Inheritance + Composite Primary Keys    forum.hibernate.org

Code: @Entity public class Company implements Serializable { @Id private Long id; @Column(nullable = false, unique=true) private String name; public Company() { } getter .. setter... } @Embeddable public class Apk ...