[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3095) Invalid queries when using subclasses and one-to-many associations
Sweta Shrestha (JIRA)
noreply at atlassian.com
Sun Apr 26 06:37:17 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33016#action_33016 ]
Sweta Shrestha commented on HHH-3095:
-------------------------------------
The mapping of collection in Cage.hbm.xml should be changed to
<bag name="animals" lazy="false" inverse="true" cascade="none" table="DCAT">
<key column="CAGE_ID" not-null="false"/>
<many-to-many column="CAT_ID" unique="true" class="DomesticCat"/>
</bag>
Thanks.
Sweta
> Invalid queries when using subclasses and one-to-many associations
> ------------------------------------------------------------------
>
> Key: HHH-3095
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3095
> Project: Hibernate Core
> 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