Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367799

Summary: Id Class is not built correctly if it is mapped
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JPAAssignee: Nan Li <nan.n.li>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: neil.hauge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Nan Li CLA 2012-01-03 17:02:22 EST
Build Identifier: I-3.4.0-20111227220343

Currently if a given id class is mapped as entity, mapped superclass, or embeddable, we stop building it (see GenericJavaIdClassReference -> resolveResourceIdClass() /GenericOrmIdClassReference -> resolveJavaResourceIdClass()); however, Spec. gives an example below

Example 6:

The parent entity uses EmbeddedId. The dependent's primary key is of the same type as that of the parent.

@Embeddable
public class PersonId {
String firstName;
String lastName;
}

@Entity
public class Person {
@EmbeddedId PersonId id;
...
}

Case (a): The dependent class uses IdClass:

@Entity
@IdClass(PersonId.class)
public class MedicalHistory {
@Id
@OneToOne
@JoinColumns({
@JoinColumn(name="FK1", referencedColumnName="firstName"),
@JoinColumn(name="FK2", referencedColumnName="lastName")
})
Person patient;
...
}

It should be fine if an id class is mapped and we should build it as normal. Take references to the comments of bug 236087 and bug 339243 when fixing this one.


Reproducible: Always