[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
Sat Jul 11 20:47:15 EDT 2009


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

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

This hasn't been been fixed in 3.3.2 which has been recently released. Any chance it might be incorporated into 3.5? The patch works fine. Patching this in the official distribution would allow us to avoid having to manually build Hibernate on each release, as well as the obvious benefit to anyone else impacted by this limitation. It sounds dumb but building Hibernate from scratch is not all that straightforward and even if you know how to go about it takes quite a while.

> 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