Sybase - Column alias in subselect doesn't works
------------------------------------------------
Key: HHH-3511
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3511
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Branch_3_2_4_SP1_CP with Sybase 15
Reporter: Juraci Paixao Krohling
I could not find any reference in documentation to support it, but it seems that column
aliasing in sub-selects isn't supported. I could not find any information in the docs
which confirms or denies this, but running the test
CriteriaQueryTest#testDetachedCriteriaAsSubQuery can confirm this.
Hibernate generates a query which ends in:
where ? in (select this_.courseCode as y0_ from Course this_ where this_.description like
?)
This fails in Sybase, with this message:
15:29:38,063 WARN JDBCExceptionReporter:77 - SQL Error: 156, SQLState: ZZZZZ
15:29:38,074 ERROR JDBCExceptionReporter:78 - Incorrect syntax near the keyword
'AS'.
Removing all "as" keywords returns the same message, even though the query
itself doesn't have it. [1]
Removing the "as $alias" solves the problem.
The working line is:
where courseCode in (select this_.courseCode from Course this_ where this_.description
like 'test%')
--
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