Community
Participate
Working Groups
we have incorrect validation for an EclipseLink default 1-1 derived id mapping. Import the attached project and notice that the Administrator.emp mapping is an id mapping instead of a 1-1 mapping in the JPA structure view. If you generate tables for this project you will get 3 incorrect validation errors. Remove the Id annotation and add it back and the problem is resolved. But if you rebuild the project or restart eclipse the problem comes back.
Created attachment 206330 [details] example project @Entity public class Administrator { @Id protected Employee emp; } @Entity public class Employee { @Id protected Integer id; }
The problem is this: - The determination of whether a mapping is specified "id" depends on the default mapping (and whether it is default 1-1). - The determination of whether a mapping is default 1-1 depends on the model being interconnected (a target entity must be resolveable.) - When we initialize the attribute, we only initialize the specified mapping information. - When we update, we only update the default mapping information if it is not a specified mapping, which it is from the initialized. We do not re-evaluate the specified mapping based on the new (potentially) default mapping information, and we do not re-evaluate the default mapping, because the mapping is already determined to be specified. In other words, it's fairly complicated. Deferring to 3.2 for these reasons: - see above (it's complicated) - it's not a regression (this exists in previous release) - this only exists for EclipseLink 2.0 + platforms, and then only in this particular case. - there is a very good workaround: simply add the @OneToOne annotation.
Created attachment 214729 [details] patch The code actually simplifies a bit when you're checking both the default and specified mapping in the same method. All tests pass (including added test case) and Karen can't break it.
Given possible risk associate with this fix, and given that it has not been reported in the field, I think it is best if we defer this to 3.3 M1.
committed fix for 3.3 M1.
Verified in build I-3.5.0-20130212155715 that when you Import the attached project the mapping show correctly as one-to-one. To view steps to verify this issue go to http://wiki.eclipse.org/Dali_3.3_M2_Release