]
Steve Ebersole closed HHH-1643.
-------------------------------
Resolution: Fixed
Sub-query as function parameter - either sub-query is missed from SQL
or NullPointerException raised
----------------------------------------------------------------------------------------------------
Key: HHH-1643
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.1.2, 3.1.3
Environment: Hibernate 3.1.2 MS SQL Server 2K
Reporter: Andy Shelton
Assignee: Steve Ebersole
Fix For: 3.6.0.Beta3, 3.5.5
Attachments: hql-sql.patch
Time Spent: 35m
Remaining Estimate: 0h
The HQL grammar HQL (hql.g) allows expressions and sub-queries as parameters to
functions, however the SQL Tree Transform grammar (hql-sql.g) does not, it only allows
expressions. This means if you pass a sub-query as a parameter to something like
"cast" for example, you will get a NullPointerException. In other cases,
typically the sub-query is missed out of the resulting SQL. This is easily remedied by
changing the first line of the definition of functionCall within hql-sql.g from:
functionCall
: #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (expr)* ) )? )
to:
functionCall
: #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (exprOrSubquery)* ) )?
)
This modification has been tested against all the existing UnitTests in Hibernate 3.1.2
and does not cause any problems.
I've included a patch for this.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: