]
Chris Wilson commented on HHH-2390:
-----------------------------------
Looks related to:
select clause alias in HQL is mapped incosistently in SQL.
----------------------------------------------------------
Key: HHH-2390
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2390
Project: Hibernate Core
Issue Type: New Feature
Components: query-hql
Affects 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: