-->
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: ordering by calculated value
PostPosted: Sun Oct 29, 2006 6:39 am 
Newbie

Joined: Wed Sep 13, 2006 11:44 pm
Posts: 2
Dear Hibernate Experts,

I need to order the results of a query by a calculated value. Specifically, I have a table with columns Latitude and Longitude and I need to order by Euclidean distance from 0, 0. In other words, i need "ORDER BY Latitude * Latitude + Longitude * Longitude" (Because sqrt is a strictly increasing function it can be omitted w/o changing the results).

I am using a DetachedCriteria rather than HQL to obtain my results. But I don't mind switching to HQL if there is a way to do it using HQL. Perhaps I can use createAlias in some way and then order by the alias?

Please help! I've been searching everywhere for the answer to this question!

Thanks very much,
Adam


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.