[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2647) Problems with OR parenthesis in HQL
David Castro (JIRA)
noreply at atlassian.com
Tue Jul 3 21:50:52 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27398 ]
David Castro commented on HHH-2647:
-----------------------------------
I am getting the same problem:
"c.owner=? and ("
+ "(c.homeNumber is not null and c.mobileNumber<>'' and c.homeNumber=?) or "
+ "(c.mobileNumber is not null and c.mobileNumber<>'' and c.mobileNumber=?) or "
+ "(c.workNumber is not null and c.workNumber<>'' and c.workNumber=?) or "
+ "(c.pagerNumber is not null and c.pagerNumber<>'' and c.pagerNumber=?) or "
+ "(c.otherNumber1 is not null and c.otherNumber1<>'' and c.otherNumber1=?) or "
+ "(c.otherNumber2 is not null and c.otherNumber2<>'' and c.otherNumber2=?) or "
+ "(c.otherNumber3 is not null and c.otherNumber3<>'' and c.otherNumber3=?) or "
+ "(c.otherNumber4 is not null and c.otherNumber4<>'' and c.otherNumber4=?))"
HQL snipped is getting converted to:
select contact0_.ym_contact_id as ym1_25_, contact0_.title as title25_, contact0_.firstName as firstName25_, contact0_.middleName as middleName25_, contact0_.lastName as lastName25_,
contact0_.emailAddress as emailAdd6_25_, contact0_.organization as organiza7_25_, contact0_.home_num as home8_25_, contact0_.mobile_num as mobile9_25_, contact0_.work_num as work10_25_,
contact0_.pager_num as pager11_25_, contact0_.other_num1 as other12_25_, contact0_.other_num2 as other13_25_, contact0_.other_num3 as other14_25_, contact0_.other_num4 as other15_25_,
contact0_.owner_id as owner16_25_ from ym_contact contact0_ where contact0_.owner_id=? and (
(contact0_.home_num is not null) and contact0_.mobile_num<>'' and contact0_.home_num=? or
(contact0_.mobile_num is not null) and contact0_.mobile_num<>'' and contact0_.mobile_num=? or
(contact0_.work_num is not null) and contact0_.work_num<>'' and contact0_.work_num=? or
(contact0_.pager_num is not null) and contact0_.pager_num<>'' and contact0_.pager_num=? or
(contact0_.other_num1 is not null) and contact0_.other_num1<>'' and contact0_.other_num1=? or
(contact0_.other_num2 is not null) and contact0_.other_num2<>'' and contact0_.other_num2=? or
(contact0_.other_num3 is not null) and contact0_.other_num3<>'' and contact0_.other_num3=? or
(contact0_.other_num4 is not null) and contact0_.other_num4<>'' and contact0_.other_num4=?)
> 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