[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3095) Invalid queries when using subclasses and one-to-many associations

Sebastien Blind (JIRA) noreply at atlassian.com
Mon Feb 4 23:01:55 EST 2008


Invalid queries when using subclasses and one-to-many associations
------------------------------------------------------------------

                 Key: HHH-3095
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3095
             Project: Hibernate3
          Issue Type: Bug
          Components: query-sql
    Affects Versions: 3.2.5
         Environment: Hibernate 3.2.5, bug identified on sybase
            Reporter: Sebastien Blind
            Priority: Blocker
         Attachments: src-cat.zip


This bug report builds on top of the topic found in the forum at http://forum.hibernate.org/viewtopic.php?t=977453

Basically, there seems to be an issue in the way hibernate treats a collections of objects that extend a base class.
The attached example has:
a Cat class
a DomesticCat class (extends Cat)
a Cage class (can contain multiple DomesticCat)

The generated SQL is below - the filter cats0_.CAGE_ID=? should really be cats0_1_.CAGE_ID=?

select
        cats0_.CAGE_ID as CAGE3_1_,
        cats0_.CAT_ID as CAT1_1_,
        cats0_.CAT_ID as CAT1_0_0_,
        cats0_1_.CAGE_ID as CAGE2_2_0_ 
    from
        CAT cats0_ 
    inner join
        DCAT cats0_1_ 
            on cats0_.CAT_ID=cats0_1_.CAT_ID 
    where
        cats0_.CAGE_ID=?

As of now, I am not aware of any configuration that would work around this problem. Please let me know if you know otherwise.

Thanks,
Sebastien

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