[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2647) Problems with OR parenthesis in HQL

Jerry Pothen (JIRA) noreply at atlassian.com
Sun Mar 16 01:54:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29816 ] 

Jerry Pothen commented on HHH-2647:
-----------------------------------

I tried changing the query by using the NOT and AND variation. But doesn't look like it's resolving the issue. 
The hql query send to hibernate createQuery method:
[3/16/08 1:43:29:957 EDT] 00000032 SystemOut     O from QueueCustomerView where (formStatusId in (102, 103, 104, 105)) and (accountOfficer in ('..','...')) and ( not ( not (responsibleBranchId = 127 and businessLineId = 112) and  not (responsibleBranchId = 130 and businessLineId = 104) and  not (responsibleBranchId = 122 and businessLineId = 112) and  not (responsibleBranchId = 108 and businessLineId = 100))) order by customerStatusId desc , reassessmentDate asc 

The hibernate generated SQL output from console:
[3/16/08 1:43:29:973 EDT] 00000032 SystemOut     O Hibernate: select ... from kycr.vw_customer_queue queuecusto0_ where (queuecusto0_.STATUS_ID in (102 , 103 , 104 , 105)) and (queuecusto0_.ACCT_OFF_ID in ('...'.'...')) and (queuecusto0_.BK_BRNCH=127 and queuecusto0_.BUSNSS_LINE=112 or queuecusto0_.BK_BRNCH=130 and queuecusto0_.BUSNSS_LINE=104 or queuecusto0_.BK_BRNCH=122 and queuecusto0_.BUSNSS_LINE=112 or queuecusto0_.BK_BRNCH=108 and queuecusto0_.BUSNSS_LINE=100) order by queuecusto0_.CUST_IS_NEW desc, queuecusto0_.REASS_DT asc

Thanks

> Problems with OR parenthesis in HQL
> -----------------------------------
>
>                 Key: HHH-2647
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2647
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.1
>         Environment: Hibernate 3.2.1, postgresql 8.2, jboss 5 embedded beta 2
>            Reporter: Dennis Fleurbaaij
>   Original Estimate: 15 minutes
>  Remaining Estimate: 15 minutes
>
> Given the following (part) of a query in HQL (where 1 to 6 are comparisons of different types (=, <=, is null), but irrelevant for the problem posted here ):
> AND ( ( 1 AND 2 ) OR ( 3 AND 4 )  OR ( 5 AND 6 ) )
> will be balanced to:
> and ( ( 1 ) and 2 or 3 and ( 4 ) or 5 and 6 )

-- 
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