We're updating the issue view to help you get more done. 

union-subclass generates bad alter table for unique constraint

Description

union-subclass mapping generates DDL with alter table that uses parent table name instead of subclass table name for UNIQUE CONSTRAINT

Example :
[main] 2013-05-28 15:37:51,165 ERROR : HHH000389: Unsuccessful: alter table Animal add constraint UK_ANIMAL unique (NAME)
[main] 2013-05-28 15:37:51,165 ERROR : GDS Exception. 335544569. Table unknown ANIMAL

---------- Animal.hbm.xml ----------

<hibernate-mapping>
<class name="com.company.product.domain.Animal" abstract="true" lazy="true">
<id name="id" type="long" column="ID" >
<generator class="assigned"></generator>
</id>
<property name="name" type="string">
<column name="NAME" unique-key="UK_ANIMAL"/>
</property>
</class>
</hibernate-mapping>

---------- Cat.hbm.xml ----------

<hibernate-mapping>
<union-subclass table="CAT" name="com.company.product.domain.Cat" extends="com.company.product.domain.Animal" lazy="true">
<property name="color" type="string">
<column name="COLOR" />
</property>
</union-subclass>
</hibernate-mapping>

Environment

Jdk 1.7
Firebird 2.5

Status

Assignee

Brett Meyer

Reporter

Aurelien DROUARD

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.2.2

Priority

Major