Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » @OneToMany SortedSet
@OneToMany SortedSet [message #741657] Wed, 19 October 2011 15:15 Go to next message
Eclipse UserFriend
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 :

@OneToMany(mappedBy="b")
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 13:23 Go to previous messageGo to next message
Eclipse UserFriend
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")

Re: @OneToMany SortedSet [message #755063 is a reply to message #748405] Mon, 07 November 2011 04:15 Go to previous message
Eclipse UserFriend
Quote:
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 Jul 22 18:01:59 EDT 2025

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

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

Back to the top