-->
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: order by clause with user-defined function
PostPosted: Fri Sep 17, 2010 1:59 pm 
Newbie

Joined: Sun Nov 30, 2003 8:51 pm
Posts: 4
We have a Family Hibernate Entity. This entity has(among others) 4 booleans properties. When retrieving the Families from the Postgres 8.4 DB, it is required that the List of families be ordered by sum of the boolean properties. There are 2 other fields in the order by criterion. Eg

Code:
select fam.a, fam.b, fam.c, fam.d, fam.e
  from family fam
order by user_defined_func() desc, fam.a asc, fam.c desc


I believe ORDER BY with a built-in function(eg : now()) is valid in Postgres SQL. Is it possible to refer to a user-defined function in the ORDER BY clause in Postgres SQL ? If yes, can I use this user defined function in a Hibernate HQL order-by clause ?

Any example code helpful.

Using Hibernate 3.3x
postgres : 8.4
java : 6

Thank you,


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.