-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL ORDER BY is ignored
PostPosted: Wed Dec 19, 2007 7:31 am 
Newbie

Joined: Wed Dec 19, 2007 7:10 am
Posts: 10
Hello,

I've Googled and found no obvious answer to this question.

I suspect I'm reporting a feature rather than a bug, but the behaviour does seem a little strange. If I execute some HQL:

from Order o order by o.name

then the SQL generated includes the ORDER BY statement that we would expect. However if I execute something like this:

from Order o1, Order o2 where o1.blah!=o2.blah order by o1.name

then the ORDER BY is not included within the SQL statement.

Why is this? Surely it's valid to order the result set by an attribute of Order? Is this a bug or deliberate behaviour?

Thanks,


John


Top
 Profile  
 
 Post subject: Solved. Bug in query parser, perhaps?
PostPosted: Wed Dec 19, 2007 10:26 am 
Newbie

Joined: Wed Dec 19, 2007 7:10 am
Posts: 10
I've made some progress. The ORDER BY is not issued when the following is added to the query:

and abs(o1.time-o2.time)<1000) order by o1.time

Note the additional close bracket that should not be present. Hibernate silently ignores this and the following order by statement.

Therefore, the ORDER isn't ignored when the query is correct but an incorrect query is getting through the parser.


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