EclipseLink 2.0.2 [message #533647] |
Fri, 14 May 2010 21:57 |
Lior Velichover Messages: 2 Registered: July 2009 |
Junior Member |
|
|
I can't get the Employee example included on the EclipseLink web-page to compile...
After MUCH effort to try and cram the new JPA2 into Eclipse/EclipseLink 2.0.2 in Galileo (which only has Facet for JPA 1.0 relying on JDK1.5)... I've been able to manually load the proper jars and get rid of almost all of the errors... but I still get ONE error that I can not get rid of:
ERROR:
Attribute named "owner" has invalid mapping for this relationship Employee.java /JPA2/src/model line 90 Validation Message
At first glance, it appears that the compiler/validator will not allow me to place a mappedBy attribute on a @oneToMany relationship... but then again, it DID allow this relationship when it came to the manager... could it be because the manager is also of type Employee and therefore the second relationship is WITHIN the Employee class ??? this is clearly a bug right? am I missing something ?
[Updated on: Fri, 14 May 2010 21:59] Report message to a moderator
|
|
|
Re: EclipseLink 2.0.2 [message #533649 is a reply to message #533647] |
Fri, 14 May 2010 23:16 |
Lior Velichover Messages: 2 Registered: July 2009 |
Junior Member |
|
|
I've narrowed it down some more... basically the issue seems to be that the mappedBy attribute is pointing to a fragment of a multi-key primary key.
i.e.
Emploee has-many PhoneNumber(s)
Employee mapped by PhoneNumber.owner
... but
PK(PhoneNumber) = ( {PhoneNumberType, Owner} )
// this PK makes sense,... distinguising Cell+Mike from Work+Mike, etc...
So, because the mappedBy is applied to Owner, and Owner is part of a PK, this fails... WHY ?!?!?! ..
I tested by adding a second Employee Reference within PhoneNumber, called it Dude... (that is not part of the PhoneNumber pk), and then when I mappedBy 'dude', everything was A-OK...
so, either:
1) JPA2.0 doesn't allow mappedBy a PK fragment, and the example should be fixed... OR
2) its a bug in EclipseLink... OR
3) I am smoking something... ??
|
|
|
|
Powered by
FUDForum. Page generated in 0.01602 seconds