| Summary: | Eclipse Editor highlights relationships used in compound primary keys as incorrect | ||
|---|---|---|---|
| Product: | [WebTools] Dali JPA Tools | Reporter: | welljim |
| Component: | General | Assignee: | dali.general-inbox <dali.general-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | karenfbutzke |
| Version: | 2.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
In Dali 2.1 we did not support JPA 2.0. Derived identities support was added in the JPA 2.0 spec. You will have to try Dali 2.2 or 2.3 to get JPA 2.0 support. *** Bug 325920 has been marked as a duplicate of this bug. *** I just realized that you're using version 2.1 of EclipseLink, so not sure what version of Dali you are using. Possibly you just need to go to the Project preferences, choose 'Project Facets' and change the version of the JPA facet to 2.0. Then you can change the platform to EclipseLink 2.1. If you don't have the option of changing the JPA facet version to 2.0 then you need to upgrade Dali Just upgraded Dali as per Karen's instructions and the problem is resolved. Thanks. |
Build Identifier: 20100218-1602 (Glassfish v3.0, upgraded with EclipseLink 2.1) Assume 2 tables that are comprised of compound Primary Keys. Also, part of the PK of table 2 is a FK of table 1. The following example illustrates this case: DEPARTMENT ---------- ID -> (PK) DEVISION_ID -> (PK) PROJECT -------- DEPT_ID -> (PK, FK) DEVISION_ID -> (PK, FK) NAME -> (PK) Given that part of Project's PK is also a FK to Department (i.e., a project can only be created under an existing department), this is mapped like so: @Entity @IdClass(ProjectId.class) public class Project { @Id @ManyToOne private Department dept; @Id private String name; // ... } public class ProjectId implements Serializable { private String name; private DeptId dept; public ProjectId() {} // ... } @Entity @IdClass(DeptId.class) public class Department { @Id private int id; @Id private int devisionId; @OneToMany(mappedBy = "dept") private List<Project> projects; // ... } public class DeptId implements Serializable { private int id; private int devisionId; public DeptId() {} // ... } This works correctly when run in Glassfish v3.0 with EclipseLink 2.1, however the Eclipse editor insists on underlining with red the annotation "@id" of field "dept" in class "Project". Hovering the mouse over the underline brings up the message "Column 'dept' cannot be resolved". In class Department, the editor underlines the mappedBy name ("dept") with the message "Attribute named 'dept' has invalid mapping for this relationship". Reproducible: Always Steps to Reproduce: 1. Recreate the tables and entities described above 2. Notice that the Eclipse editor underlines the @Id and mappedBy as incorrect 3. Populate the table with some random data and run the configuration in Glassfish or other compatible engine 4. The configuration runs as expected, and all find(), merge(), remove() operations work without a problem