I tried the following mapping
Code:
<class name="Actor" abstract="true">
<id name="identifier" type="long">
<generator class="hilo" />
</id>
<version name="entityRevision" />
<union-subclass name="Group" table="UserGroup">
<property name="name" type="string" unique="true"/>
<many-to-one name="parentGroup" />
<set name="childrenGroups" inverse="true">
<key property-ref="parentGroup" />
<one-to-many class="Group" />
</set>
</union-subclass>
<union-subclass name="User">
<property name="disabled" type="boolean" />
<property name="eMail" type="string"/>
<property name="accountName" type="string" />
<property name="fullName" type="string" />
<property name="encPassword" type="string" />
</union-subclass>
</class>
with HSQLDB dialect and I obtain the following:
Code:
3766 ERROR org.hibernate.tool.hbm2ddl.SchemaExport
Unsuccessful: alter table UserGroup add constraint FK8A5BE15445D99518 foreign key (parentGroup) references UserGroup
3776 ERROR org.hibernate.tool.hbm2ddl.SchemaExport
Constraint not foundtable has no primary key in statement [alter table UserGroup add constraint FK8A5BE15445D99518 foreign key (parentGroup) references UserGroup]
Is it correct? It looks really similar to the documentation example to me what I did wrong?
Thank you very much,
Davide