| I added these test cases which prove that, for @MappedSuperclass, there is no issue. The supplied test case was wrong since it contained the following mapping:
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public static class AbstractEntity {
@Id
private Long id;
@Column(name = "code", nullable = false, unique = true)
private String code;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
@Entity(name = "Category")
public static class CategoryEntity extends AbstractEntity {
}
@Entity(name = "Taxon")
@Table(name = "taxon", uniqueConstraints = @UniqueConstraint(columnNames = { "catalog_version_id", "code" }))
@AttributeOverride(name = "code", column = @Column(name = "code", nullable = false, unique = false))
public static class TaxonEntity extends CategoryEntity {
@Column(name = "catalog_version_id")
private String catalogVersion;
public String getCatalogVersion() {
return catalogVersion;
}
public void setCatalogVersion(String catalogVersion) {
this.catalogVersion = catalogVersion;
}
}
Notice that @AbstractEntity was using both @MappedSuperclass and @Inheritance which is not a valid mapping. Once you remove the @Inheritance mapping and make TaxonEntity extend @AbstractEntity everything works fine. Overriding properties from entity classes which are annotated with @Inheritance is not supported as it will not work for SINGLE_TABLE inheritance. Therefore, I'm closing this issue. |