| Here's my setup:
@Entity(name = "category")
public class CategoryEntity {
@Id
private Long id;
@Column(name = "code", nullable = false, unique = true)
private String code;
}
and
@Entity(name = "taxon")
@AttributeOverride(name = "code", column = @Column(name = "code", nullable = false, unique = false))
public class TaxonEntity extends CategoryEntity {
}
then I want to create schema using the hbm2ddl SchemaExport tool and here's what I get:
alter table category
add constraint UK_acatplu22q5d1andql2jbvjy7 unique (code);
alter table taxon
add constraint UKcqy7383ll4wy6b9efu96s20o7 unique (catalog_version_id, code);
alter table taxon
add constraint UK_ko1v2asmbj5kfeapum261i6c7 unique (code);
The unique constraint on category table is correct, however the one on taxon table is not - it has 2 constraints instead of just 1, even though I have defined that I override the code attribute. |