Error with sql generated for set of subclass A in a peer subclass B.

Description

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.

Environment

None

Activity

Show:
Austin Mayberry
February 3, 2009, 10:43 PM

I have resubmitted this bug against all versions since it got no comments.

Paul Pogonyshev
February 4, 2009, 2:41 PM

Looks like the same bug as 3748.

Steve Ebersole
March 21, 2011, 7:09 PM

Bulk closing stale resolved issues

Assignee

Gail Badner

Reporter

Austin Mayberry

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure