[hibernate-issues] [Hibernate-JIRA] Created: (ANN-707) Erroneous SQL goes to Oracle when using operator IN with composite key
botWi (JIRA)
noreply at atlassian.com
Fri Mar 14 04:01:33 EDT 2008
Erroneous SQL goes to Oracle when using operator IN with composite key
----------------------------------------------------------------------
Key: ANN-707
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-707
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.CR1
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