Hibernate version:
Hibernate 3.0.2
Mapping documents:
Code:
<class name="A">
<id name="id">
<generator class="sequence">
<param name="sequence">id_seq</param>
</generator>
</id>
<many-to-one name="backLink"/>
</class>
<joined-subclass name="B" extends="A">
<key column="id"/>
<set name="as" inverse="true">
<key column="backLink"/>
<one-to-many class="A"/>
</set>
</joined-subclass>
Generated database schema:Code:
create table A (id int8 not null, backLink int8, primary key (id))
create table B (id int8 not null, primary key (id))
alter table A add constraint FK41D36BE61D foreign key (backLink) references B
alter table A add constraint FK41D36BE61C foreign key (backLink) references A
alter table B add constraint FK4254F609D6 foreign key (id) references A
create sequence id_seq
Hello, I think that either I'm doing something wrong, either the generated database schema is wrong. I shouldn't get two foreign key constraint on backLink, only the one that references the base class ...
The problem is not happening, if I'm not referencing the base class from the subclass, but from an other class.