Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » EclipseLink 2.0.2(Example from EclipseLink page not working)
EclipseLink 2.0.2 [message #533647] Fri, 14 May 2010 21:57 Go to next message
Lior Velichover is currently offline 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 Go to previous messageGo to next message
Lior Velichover is currently offline 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... ??
Re: EclipseLink 2.0.2 [message #533942 is a reply to message #533649] Mon, 17 May 2010 14:25 Go to previous message
Paul Fullbright is currently offline Paul Fullbright
Messages: 200
Registered: July 2009
Senior Member
First a note that this would probably be better placed on either the EclipseLink forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id= 111&

or the Dali (JPA configuration UI) forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id= 113


Secondly, which example are you talking about exactly? Is it this one? http://wiki.eclipse.org/EclipseLink/Examples/JPA/2.0/Employe e

That is a preview of EclipseLink JPA 2.0 mappings, and is not really an example of JPA 2.0 in general. What exactly did you change to "make it work"? Did you change the facet version or the platform?

Previous Topic:Re: Problems with JSF Pages
Next Topic:Almost completed WTP Tutorials - Building and Running a Web Application
Goto Forum:
  


Current Time: Thu Oct 23 21:36:02 GMT 2014

Powered by FUDForum. Page generated in 0.01773 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software