-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: How to specify sort order for collection using annotations?
PostPosted: Tue Feb 08, 2005 5:41 pm 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
Hibernate version: hibernate-3.0beta3, hibernate-annotations-3.0alpha2

I'm using annotations and have defined the following ManyToMany relationship which is working fine. The question that I have is, is there a way that I can specify the sort order for the Item collection using an annotation? I'm pretty sure you can do this using the XML configuration file way of doing things, not sure about annotations...

Code:
   @ManyToMany(fetch=FetchType.LAZY)
   @AssociationTable(table=@Table(name="ReservationItem"),
   joinColumns={@JoinColumn(name="reservationId")},
   inverseJoinColumns={@JoinColumn(name="itemId")}
   )
   public Collection<Item> getItems() {
      return items;
   }


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 1:05 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Not yet, I'm working on the Hibernate Annotations for its specific features

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 4:01 pm 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
Thanks for the info. Have the EJB annotations been finalized yet though? It seems like this capability should be part of the EJB 3.0 standard.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 4:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This point is still in discussion with the List / Map support

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 14, 2005 7:15 pm 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
I don't know what the issues at hand are, but, adding List and Map support has my vote.

I was thinking that if nothing else, I could just sort the Collection after the fact, but, then I realized that Collections.sort() expects a list, not a Collection.

I guess maybe, I could copy the Collection to an ArrayList, then set the Collection in the POJO to the ArrayList...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 15, 2005 6:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Anyway, Hibernate Annotation will suport it, whether as an EJB3 feature or specific extension.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.