-->
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: Order by broken!?
PostPosted: Sat Mar 24, 2007 9:00 am 
Newbie

Joined: Thu Dec 23, 2004 7:23 am
Posts: 12
Location: Melbourne
Is order by broken in 3.2.1ga?

I have this HQL query:

Code:
select book from Book as book order by book.pdate


That generates the following SQL query:

Code:
select
    book0_.id as id4_,
    book0_.version as version4_,
    book0_.read_count as read3_4_,
    book0_.pdate as p4_4_,
    book0_.title as title4_,
    book0_.publish_date as publish6_4_,
    book0_.description as descript7_4_,
    book0_.link as link4_,
    book0_.blog_id as blog9_4_
from
    book book0_
order by
    book0_.pdate


As you can see, the pdate is aliased as p4_4 in the select clause, but as pdate in the order by clause. Any ideas what is possibly wrong?

Thanks in advance,
Behi

_________________
http://www.koderblogz.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 24, 2007 10:45 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Do you get any exception???

I don't see what the problem is. Maybe it could use the alias, but it also works this way, isn't? I don't see why it could cause any problem?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 24, 2007 7:05 pm 
Newbie

Joined: Thu Dec 23, 2004 7:23 am
Posts: 12
Location: Melbourne
batmat wrote:
Do you get any exception???

I don't see what the problem is. Maybe it could use the alias, but it also works this way, isn't? I don't see why it could cause any problem?


The problem is that the result is not sorted!

_________________
http://www.koderblogz.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 25, 2007 7:31 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
1) Did you test with an older version of Hibernate to see if any difference had been introduced? If so, maybe file a bug report: http://opensource.atlassian.com/project ... browse/HHH

2) Well, what is your db anyway? Before answering last time, I tested a similar query with HSQL, and it doesn't care you're using the alias or the real column name...Both works without problem. So maybe this bug is db related?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: Related issue
PostPosted: Sun Mar 25, 2007 9:29 pm 
Newbie

Joined: Tue Feb 28, 2006 5:03 pm
Posts: 15
Location: North Carolina
I believe this issue is related to this problem: http://forum.hibernate.org/viewtopic.php?t=972476

It appears there is a bug in the HQL generator


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.