| Hi, Given the following mapping for the parent table (the fact that it is a @Entity, not a @MappedSuperclass is important):
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class ElementReference<ER extends ElementReference<?>> implements Serializable {
@Id
@GeneratedValue
private Long id;
@Column(unique = true)
@NaturalId
private String code;
with the following child table:
@Entity
public class ActiviteCategorie extends ElementReference<ActiviteCategorie> {
Hibernate logs the following error when starting the context (and the context is successfully started anyway):
Caused by: org.h2.jdbc.JdbcSQLException: Table "ELEMENTREFERENCE" not found; SQL statement:
alter table ElementReference
add constraint UK_omp32uxdf5mak3hx6gfe6dq4c unique (code) [42102-176]
This mapping was OK with Hibernate < 5 and Hibernate should not try to create a contraint for this table. I will push a test case using the Hibernate templates in a followup comment. |