[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2158) incorrect hql query on one-to-one with property-ref

Marc Palmer (JIRA) noreply at atlassian.com
Mon Jun 22 12:53:33 EDT 2009


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

Marc Palmer commented on HHH-2158:
----------------------------------

Guys this issue causes real pain in Grails - you can't query for objects in a 1:1 that are not currently associated, so you can't make any kind of efficient UI that shows only unassociated items - you have to iterate over EVERY object and pick out those with null associate.


> incorrect hql query on one-to-one with property-ref 
> ----------------------------------------------------
>
>                 Key: HHH-2158
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2158
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.0.ga
>         Environment: hibernate 3.2.0.ga with firebird 1.5.3 and jaybird 1.5.5 driver on windows XP
>            Reporter: Sebastien Cesbron
>         Attachments: testhib.zip
>
>
> I have a one-to-one relationship with property-ref between Master and Slave2.
> I want to find all Master instances that have a null Slave2 instance associated.
> To do so my query is
> select master from Master master where master.slave2 is null
> The sql generated is
> select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_ where master0_.oid is null
> which seems incorrect. It checks here Master instances with null id (config files are listed below).
> If I do my query like this
> select master from Master master where master.slave2.oid is null
> the generated sql is ok :
> select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_, Slave2 slave2x1_ where master0_.oid=slave2x1_.myMaster and (slave2x1_.oid is null)
> I have attached a small eclipse project that reproduces the problem
> This problem may-be related to the one I have submitted as issue HHH-1849

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