Same bug as but filed for hibernate 3. Not every database supports formulas or functions in WHERE clauses, and while we would love to get rid of them, it's not always realistic.
It should not be hard to reuse the alias generated for formulas from the SELECT clause.
This does not work on every DB:
This works on several DBs:
If there are any DBs where hibernate is broken because of that, it should be a Dialect feature.
In the original bug report, Gavin mentioned trivial workarounds. It would be helpful to show them in the bug report too, since they might not be obvious (I've no clue for instance).
Is this still an issue using 3.5.1? If so, please do the following:
update an existing test or add a new test to testsuite
attach a patch with the updated/added unit test using svn diff
if you have a fix, please attach a patch with your fix using svn diff
Also, please let us know which (if any) dialects tested at http://hudson.jboss.org/hudson/job/hibernate-core-testsuite/ are affected.
Note: In an attempt to clean up the HHH JIRA, we will be rejecting any ticket that sits in the "Awaiting Test Case" state for 2-3 months with no response. So, if this issue is critical to you, please attach a reproducing test case ASAP. Thanks!
Bulk rejecting issues lacking a test case or recent response.