[hibernate-issues] [Hibernate-JIRA] Moved: (HHH-3184) Erroneous SQL goes to Oracle when using operator IN with composite key

Emmanuel Bernard (JIRA) noreply at atlassian.com
Fri Mar 14 10:30:32 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard moved ANN-707 to HHH-3184:
-------------------------------------------

    Affects Version/s:     (was: 3.3.1.CR1)
                       3.2.6
                  Key: HHH-3184  (was: ANN-707)
              Project: Hibernate3  (was: Hibernate Annotations)

> Erroneous SQL goes to Oracle when using operator IN with composite key
> ----------------------------------------------------------------------
>
>                 Key: HHH-3184
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3184
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.6
>         Environment: Hibernate 3.2.6
> Hibernate Annotations 3.3.1.CR1
> Hibernate EntityManager 3.3.2.CR1
> Oracle 10g
>            Reporter: botWi
>
> entity Footballer has composite primary key defined via @IdClass and @Id getters (see http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#entity-mapping-identifier)
> entity Goal has property 'footballer' defined via @ManyToOne
> query
>   select g from Goal g where g.footballer in (select f from Footballer f where f.age=22)
> is translated to erroneous SQL
>   select goal0_.id as col_0_0_ from tgoal goal0_ where (goal0_.fb_firstname, goal0_.fb_lastname) in (select (footballer1_.fb_firstname, footballer1_.fb_lastname) from tfootballer footballer1_ where footballer1_.age=22)
> it's strange, but the slightly modified query
>   select g from Goal g where g.footballer.id in (select f.id from Footballer f where f.age=22)
> is translated to valid SQL
>   select goal0_.id as col_0_0_ from tgoal goal0_ where (goal0_.fb_firstname, goal0_.fb_lastname) in (select footballer1_.fb_firstname, footballer1_.fb_lastname from tfootballer footballer1_ where footballer1_.age=22)

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