[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2278) joined-sbuclass + oneToMany eager lead to incorrect SQL

Anthony Patricio (JIRA) noreply at atlassian.com
Fri Dec 1 10:22:04 EST 2006


joined-sbuclass + oneToMany eager lead to incorrect SQL
-------------------------------------------------------

         Key: HHH-2278
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2278
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.1    
 Environment: H 3.2.1
    Reporter: Anthony Patricio
    Priority: Minor
 Attachments: bug.zip

Model:
Injury *--1 Person 
Suspect extends Person (joined subclass)
Suspect 1--* Case (eager with fetch=join)

Part of the SQL generated when executing "from Injury":
from Person person0_ 
  left outer join Suspect person0_1_ 
    on person0_.id=person0_1_.PERSON_ID 
  left outer join Case cases1_ 
    on person0_.id=cases1_.PERSON_ID 
where person0_.id=?

should be:
from Person person0_ 
  left outer join Suspect person0_1_ 
    on person0_.id=person0_1_.PERSON_ID 
  left outer join Case cases1_ 
    on person0_1_.id=cases1_.PERSON_ID 
where person0_.id=?

A simple workaround is to define
Suspect 1--* Case (eager with fetch=select, instead og join)

I've attached a testcase (EJB3 + hbm)


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