title: Filtering on calculated columns in hibernate? (HAVING)
body: <p>Say I have a table with two columns, X and Y.
  I would like to run the following query via hibernate:</p>
  
  <pre><code>SELECT X*X + Y*Y AS Distance, POINTS.* from POINTS 
  WHERE X &gt; 0 
  AND Y &gt; 0
  HAVING Distance &lt; 50
  </code></pre>
  
  <p>How do I achieve it via hibernate? Can you provide a code sample?</p>
  
  <p><strong>Edit</strong> - <a href="https://stackoverflow.com/questions/467172/hibernate-criteria-api-having-clause-work-arounds">This question</a> seems heavily related. The only reason I'm not closing this one as a duplicate, is because it provides a much simpler use case (no GROUP BY).</p>