Community
Participate
Working Groups
Build Identifier: 20100218-1602 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
This bug should be filed under Dali in the WebTools project. I have sent an FYI to one of the Dali committers, but it would be safer for you to refile with the correct project than to assume this will get picked up. I was not able to figure out how to correctly edit the Product.
Re-assigning to Dali project.
What version of the Eclipse IDE are you using?
Re-closing. Didn't realize that bug was already re-entered as requested. *** This bug has been marked as a duplicate of bug 326093 ***