[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2390?page=all ]
Steve Ebersole updated HHH-2390:
--------------------------------
type: New Feature (was: Bug)
Assign To: Steve Ebersole
Priority: Minor (was: Major)
This is *not a bug*. This has never been claimed as a feature of HQL. In fact it has
been explained over and over that this is not possible in HQL.
However, this is something that I want to add the capability for as I am re-writing the
query translators.
And actually I am pretty sure there are already existing JIRA requests for this...
select clause alias in HQL is mapped incosistently in SQL.
----------------------------------------------------------
Key: HHH-2390
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2390
Project: Hibernate3
Type: New Feature
Components: query-hql
Versions: 3.2.2
Environment: Win2K+JDK1.5+Eclipse3.2.1+Hibernate3.2.2, Solaris Express x86+MySQL5
Reporter: Natto Lover
Assignee: Steve Ebersole
Priority: Minor
Attachments: HQLTest.zip
Hi. I was told at the users forum to post a test case here.
I give an alias to an expression in the select clause, try to refer it in the where
clause. In SQL, Hibernate replaces the alias in the select clause, but leaves the original
text in the where clause.
This is the HQL:
select (p.endDate - p.startDate) as period, p
from Project as p
where period > :period_length
See above where the alias 'period' appears.
Now, This is the resulting SQL: select
project0_.end_date-project0_.start_date as col_0_0_,
project0_.id as col_1_0_,
project0_.id as id0_,
project0_.name as name0_,
project0_.start_date as start3_0_,
project0_.end_date as end4_0_
from PROJECT project0_ where period>?
Note above the 'period' that was in the select clause is replaced with machine
generated "col_0_0_", but that is not applied for the alias in the where clause.
Please find attached a test case archive.
Two HQL statements are tried. One uses the alias in the where clause, the other one uses
the alias in the order by clause.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira