-->
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.  [ 5 posts ] 
Author Message
 Post subject: question of the example in hibernate2.1.3
PostPosted: Sat May 01, 2004 12:22 pm 
Newbie

Joined: Tue Apr 27, 2004 2:36 am
Posts: 12
I want get a list of users which be sorted by the size of user.bids

so I write a HQL like this
Code:
select user from User as user order by user.bids


it caught a exception
Code:
net.sf.hibernate.QueryException: unindexed collection before []: user0_.bids [select user from org.hibernate.auction.User as user order by user.bids]


how can I write this HQL??????


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
select user from User as user join user.bids as bid order by bid.amount

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 12:42 pm 
Newbie

Joined: Tue Apr 27, 2004 2:36 am
Posts: 12
I change it to
Code:
select user from User as user join user.bids as bid group by user order by bid.amount



It works correctly

thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 12:52 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Oh, btw, don't use "user" as an alias (keyword in some dialects), use "as uzer" or something like that.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 1:10 pm 
Newbie

Joined: Tue Apr 27, 2004 2:36 am
Posts: 12
I'm back, sorry, hehe

I don't understand why sorted by the bid.amount.

I want sorted by the size of user.bids..

I think the HQL is NOT CORRECT now.... :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.