How to use @UniqueConstraint with single table inheritance (JPA)?
问题 I have a class extending an existing entity with single table strategy (which I can't change). I want to use UniqueConstraint for that entity so I tried: @Entity @Table(name = "t_document") public class Document implements Serializable { ... } and @Entity @Table(uniqueConstraints = { @UniqueConstraint(name = "Test", columnNames = { ... }) }) public class MyDocument extends Document { ... } The unique constraint is not used at all, nothing in log file. Is this the correct way to use