Say I've got a table with two posts, X and Y. I must run the next query via hibernate:
SELECT X*X + Y*Y AS Distance, POINTS.* from POINTS WHERE X > 0 AND Y > 0 HAVING Distance < 50
How do you do it via hibernate? Are you able to give a code sample?
Edit - This question appears heavily related. The only real reason I am not closing that one like a duplicate, happens because it possesses a easier use situation (no GROUP BY).
In many dialects of SQL, you can't make use of the 'display label' or even the title in 'AS name' to consult a manifestation within the body from the query - much towards the chagrin of individuals. However, you should use the expression within the WHERE clause.
SELECT X*X + Y*Y AS DistanceSquared, POINTS.* from POINTS WHERE X > 0 AND Y > 0 AND (X * X + Y * Y) < 50;
The Getting clause is connected with aggregates and evaluations on aggregates:
SELECT name, COUNT(*) FROM SomeWhere GROUP BY Name HAVING COUNT(*) > 1;
The circumstances inside a Getting clause must (should) involve a minumum of one 'direct' aggregate another term within the condition may well be a constant (as proven) or any other direct aggregate, or perhaps a sub-query, possibly including 'indirect' aggregates. (AFAIK, I have invented the 'direct/indirect' terminology with this answer - you most likely will not have the ability to look for the expression usefully.)