[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1643) Sub-query as function parameter - either sub-query is missed from SQL or NullPointerException raised

Manuel Dominguez Sarmiento (JIRA) noreply at atlassian.com
Fri Apr 10 19:59:17 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32846#action_32846 ] 

Manuel Dominguez Sarmiento commented on HHH-1643:
-------------------------------------------------

We built the project from source using Maven after applying this patch manually on 3.3.1 GA and it worked fine. Subqueries as function parameter now work as expected.

I can confirm that all tests pass as well. Please include this fix in the next official release.

> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list