[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1780) negation of EXISTS in hql query does not work

Nikolaus Rumm (JIRA) noreply at atlassian.com
Wed Oct 10 08:37:39 EDT 2007


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

Nikolaus Rumm commented on HHH-1780:
------------------------------------

Same here.

We found the bug because Hibernate optimizes HQL queries by applying De Morgan's laws.

from Table t where not ( t.name is null and exists(select r.oid from Table r))
->
select .... from table table_1 where table_1.name is not null or exists(select table_2.oid from table table_2)

The exists clause is not inverted.

> negation of EXISTS in hql query does not work
> ---------------------------------------------
>
>                 Key: HHH-1780
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1780
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2
>            Reporter: Marton Papp
>
> Hello!
> I think I found a bug in Hibernate, in class org.hibernate.hql.ast.HqlParser.
> It is in the methtod:
> public AST negateNode(AST x)
> The switch lacks the node type: EXISTS.
> The default negateNode() implementation in org.hibernate.hql.antlr.HqlBaseParser seems to be broken by me, since it  does not actually inverts the node but returns a node that is inverted. Or, to be more exact, the negation of OR and AND types are buggy, since they seem to assume that negateNode() will change the node itself, and so they simply discard its return value.
> I wish the branch for NOT was not commented out, since it would provide a workaround, but now i'm stuck.
> Regards,
> Marton 

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