Here's my setup:
{code}
@Entity(name = "category") public class CategoryEntity {
@Id private Long id;
@Column(name = "code", nullable = false, unique = true) private String code;
}
{code}
and {code} @Entity(name = "taxon") @ Table(uniqueConstraints = @UniqueConstraint(columnNames = { "catalog_version_id", "code" })) @ AttributeOverride(name = "code", column = @Column(name = "code", nullable = false, unique = false)) public class TaxonEntity extends CategoryEntity {
} {code}
then I want to create schema using the hbm2ddl {{SchemaExport}} tool and here's what I get: {code}
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);
{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. |
|