Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @OneToMany SortedSet
@OneToMany SortedSet [message #741657] Wed, 19 October 2011 19:15 Go to next message
Marc  is currently offline Marc Friend
Messages: 12
Registered: September 2011
Junior Member
In order to guarantee preserving the order after any add/remove operation, I'm trying to use a TreeSet attribute under a jpa project as follows :

private TreeSet<A> manyA;

'A' does implement the Comparable<A> interface.

The problem is that i'm getting the following compile time error :
Target entity for "manyA" is not defined.

If i replace TreeSet by Set the error disappears, i tried the SortedSet interface but still having the same error.

I'm using eclipselink 2.3.0, and Eclipse EE IDE Indigo.

Is there any way to make eclipseLink accept SortedSet mapped attributes?
Re: @OneToMany SortedSet [message #748405 is a reply to message #741657] Mon, 24 October 2011 17:23 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Is this a compile error, or just a warning from Eclipse's JPA support?

If you just ignore the warning, does it work?

You can give the targetEntity in the annotation and probably make the warning go away.

JPA only allows Collection, List and Set for collection types, but EclipseLink will support any implementation is you use EAGER. For LAZY support, one of the three interfaces is currently required. You could use Set, and assign a TreeSet to it, however EclipseLink would use its LAZY Set, IndirectSet when restoring from the database.

So try,
@OneToMany(targetEntity=A.class, fetch=EAGER, mappedBy="b")

James : Wiki : Book : Blog : Twitter
Re: @OneToMany SortedSet [message #755063 is a reply to message #748405] Mon, 07 November 2011 09:15 Go to previous message
Pedro Jos is currently offline Pedro JosFriend
Messages: 2
Registered: November 2011
Junior Member
The problem is that i'm getting the following compile time error :
Target entity for "manyA" is not defined.

Had the same problem. In my case I need to add the import, ┬┐do you have import java.util.TreeSet?
Previous Topic:Partition - id on new entities?
Next Topic:Audit trail
Goto Forum:

Current Time: Tue May 22 16:09:44 GMT 2018

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

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

Back to the top