Error with sql generated for set of subclass A in a peer subclass B.
--------------------------------------------------------------------
Key: HHH-3107
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3107
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
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.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira