-->
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: order by nulls last
PostPosted: Mon May 09, 2005 8:26 pm 
Newbie

Joined: Mon May 09, 2005 8:22 pm
Posts: 3
I am unable to find support for "nulls last" in HQL order by clauses.

Is it easy to extend or override implementations to add support for something like this?

Thanks,

Andrew


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 8:59 pm 
Newbie

Joined: Mon Jan 31, 2005 1:33 pm
Posts: 11
This really is an issue with the database and does not have anything to do with Hibernate. Hibernate simply issues the "order by" in the generated sql and then just returns it in the order supplied by the database.


Top
 Profile  
 
 Post subject: Granted the ordering is done by the database...
PostPosted: Mon May 09, 2005 9:31 pm 
Newbie

Joined: Mon May 09, 2005 8:22 pm
Posts: 3
That is why I need to extend Hibernate to support the execution of a NULLS LAST order by clause for Oracle.

I'm not sure of the appropriate place to do this, and if there is interest in putting this on the "wish list".


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 2:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Can you describe the exact syntax of this?
Can you google and tell us which other databases support this?

Once this done, i'll submit the question to the team.

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 2:47 pm 
Newbie

Joined: Mon May 09, 2005 8:22 pm
Posts: 3
It is problematic for the developer to not have control over sorting of nulls.

In different DBs, the sorting of nulls relative to other values is handled differently.

PostgreSQL - Nulls are considered HIGHER than non-nulls.
DB2 - Higher
MSSQL - Lower
MySQL - Lower
Oracle - Higher

"NULLS LAST" is part of the SQL 99 standard.

The syntax is as follows:

ORDER BY [COLUMN NAME] [ASC | DESC] [NULLS FIRST | NULLS LAST]

The following DBs have supported this functionality:

DB2 V7
Oracle 9i

PostgreSQL, MySQL, SQLServer do not appear to support this from what I can gather.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 4:39 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
http://opensource.atlassian.com/project ... se/HHH-465

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.