| Summary: | incorrect JPA Problem: In attribute 'employee', the "maps ID" value 'employee' does not refer to an attribute that is used as an ID for this entity | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [WebTools] Dali JPA Tools | Reporter: | elhanan Maayan <elh.mailgate> | ||||
| Component: | JPA | Assignee: | Neil Hauge <neil.hauge> | ||||
| Status: | RESOLVED INVALID | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | neil.hauge | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 3.0.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
elhanan Maayan
Created attachment 201399 [details]
entire project
Comment on attachment 201399 [details]
entire project
i've excluded the jars becouse of the size
A quick glance at the code seems to indicate that we are comparing against all id mappings in the class hierarchy, but something must be going wrong. Thanks for the test project. please note that i get an additional error of: The type of the ID mapped by the relationship 'employee' does not agree with the primary key class of the target entity. After reviewing the example, it would appear to me that the error is correct, in that the MapsId isn't referring to an attribute used for the Id of the entity. I don't have your DB schema so perhaps there is something I'm missing, but I would expect the mapsId on JobHistory for the employee attribute to be defined as:
@MapsId("employeeId")
The MapsId should be mapping an identifier attribute from the JobHistory entity (not the Employee entity), which in this case is defined by JobHistoryPK:
@EmbeddedId
private JobHistoryPK id;
JobHistoryPK defines the employeeId attribute, which is what I would guess the MapsId should be mapping.
If there is some other Hibernate specific usage going on here, then they may need to customize this validation for their platform. Otherwise, if I am not understanding your use case correctly, please explain a bit more how you are expecting this mapping to work.
sorry my bad it works now Marking as not a bug. |