-->
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.  [ 1 post ] 
Author Message
 Post subject: List ordering with @OneToMany
PostPosted: Tue Oct 17, 2006 5:16 pm 
Newbie

Joined: Sat Mar 11, 2006 4:15 pm
Posts: 15
I have a @OneToMany on a list:
Code:
   @OneToMany
   @Cascade({ALL, DELETE_ORPHAN})
   public List<PriceTier> getPriceTiers() {
      return priceTiers;
   }


Chapter 2 in the annotations documentation says:

Quote:
The EJB3 specification describes how to map an ordered list (ie a list ordered at load time) using @javax.persistence.OrderBy annotation: this annotation takes into parameter a list of comma separated (target entity) properties to order the collection by (eg firstname asc, age desc), if the string is empty, the collection will be ordered by id.


When we run with HSQLDB everything works as expected. But when run with mysql the select to load the collection doesn't have an order by clause and mysql will return the results in the wrong order. My question is, do I need to specify an @OrderBy or can I use a List and rely on this ordering by id?


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

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.