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