Is is possible using Hibernate (prefferably the Criteria API) to use a mySql function to Order By.
The function I am looking to use is :-
SQRT( POW( 69.1 * ( {alias}.latitude - 51.3814282 ) , 2 ) + POW( 69.1 * ( -2.3574537 - {alias}.longitude ) * COS( {alias}.latitude / 57.3 ) , 2 ) )
where the {alias} is rooted at
criteria.createCriteria("location.address");
All I am looking to do is have the results ordered by the above distance equation, but thus far I havent found a way using the Projections options or the Order. options and am running out of ideas.
Cheers, R