[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643?page=c...
]
Manuel Dominguez Sarmiento commented on HHH-1643:
-------------------------------------------------
Any chance of getting this patch into the Hibernate trunk? We've been patching
Hibernate for almost a year and a half already because of this simple one-line fix.
We've been running HQL queries in production that require this patch ever since then,
without any troubles.
Again, this is not laziness, but patching this part of Hibernate requires a carefully
setup environment, since it involves ANTLR-generated bytecode, a full Maven build has to
be performed (which not always works out of the box, there are several show-stoppers which
we've worked around to get this process internally streamlined each time a new
Hibernate release comes out). If it were any other part of the library, we could simply
swap .class files inside of the JAR (ugly, but it works), but this is simply not the case
here.
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
Attachments: hql-sql.patch
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:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira