]
Austin Mayberry commented on HHH-3752:
--------------------------------------
I have resubmitted this bug against all versions since it got no comments.
Error with sql generated for set of subclass A in a peer subclass B.
--------------------------------------------------------------------
Key: HHH-3752
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3752
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.4, 3.2.4.sp1, 3.2.5, 3.2.6, 3.2.x, 3.3.0.CR1, 3.3.0.CR2,
3.3.0.GA, 3.3.0.SP1, 3.3.1, 3.3.x
Reporter: Austin Mayberry
A mapping such as the following contrived examples does not yield the expected results
and causes and error:
<class name="com.foo.Foo1" table="FOO1">
<id
name="id"
type="java.lang.Integer"
column="ID"
>
<generator class="sequence" >
<param name="sequence">ID_SEQ</param>
</generator>
</id>
<discriminator column="FOO_TYPE_ID" type="java.lang.Integer"/>
<subclass name="com.foo.Foo2" discriminator-value="0">
<join table="FOO2">
<key column="ID"/>
<property
name="label"
type="java.lang.String"
column="LABEL"
not-null="true"
length="255"
/>
</join>
<subclass name="com.foo.BarOne" discriminator-value="1">
<set
name="barTwos"
inverse="true"
>
<key>
<column name="PARENT_ID" />
</key>
<one-to-many class="com.foo.BarTwo" />
</set>
</subclass>
<subclass name="com.foo.BarTwo" discriminator-value="2">
<join table="BAR">
<key column="ID"/>
<many-to-one
name="parent"
class="com.foo.BarOne"
not-null="true"
column="PARENT_ID"
/>
</join>
</subclass>
</subclass>
</class>
The sql created to populate the set "bartwos" looks like this looks like:
select
bartwos0_.PARENT_ID as PA3_1_,
bartwos0_.ID as ID1_1_,
bartwos0_.ID as ID1_52_0_,
bartwos0_.FOO_TYPE_ID as FO2_52_0_,
bartwos0_1_.LABEL as LABEL76_0_,
bartwos0_2_.PARENT_ID as PA2_87_0_
from FOO1 bartwos0_, FOO2 bartwos0_1_, BAR2 bartwos0_2_
where bartwos0_.ID=bartwos0_1_.ID
and bartwos0_.ID=bartwos0_2_.ID
and bartwos0_.PARENT_ID=?
And yields the following error message:
java.sql.SQLException: ORA-00904: "BARTWOS0_"."PARENT_ID: invalid
identifier
The basic problem is that it should be looking for the property PARENT_ID on BAR2, but it
is looking for it on FOO1.
I am refiling this bug because I originally only filed agains 3.2.4. It has been a year
with no comments on it so I a resubmitting for all affected versions I have tried.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: