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,