[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPA 2 @OrderColumn question

Set, and HashSet are not ordered.  These collection types have no order in
Java, so I'm not sure what expect???

If you want order, you need to use a List in Java.  Lists are generally more
usable collection types.
You can add a constraint to your join table to enforce no duplicates.

NBW wrote:
> I was reading over the docs [1] regarding Eclipselink's support for
> @OrderColumn. It looks like this only applies to List and not Set. The
> reason I ask is because I have a ManyToMany bi-directional relationship
> (using a join table) which is a Set and is implemented with a HashSet
> because the collection can't have duplicates.  
> I wanted to order the entries in this set using @OrderColumn, but it
> appears I can only apply this to List, however using List will break my
> unique requirement.  Is this understanding correct?
> If so what is the recommended strategy for this case?
> Thanks,
> -Noah
> [1] - http://wiki.eclipse.org/EclipseLink/Examples/JPA/2.0/OrderColumns

http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
View this message in context: http://old.nabble.com/JPA-2-%40OrderColumn-question-tp33972744p33976159.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.