Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367799 - Id Class is not built correctly if it is mapped
Summary: Id Class is not built correctly if it is mapped
Status: NEW
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 17:02 EST by Nan Li CLA
Modified: 2013-09-11 10:21 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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