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 UniqueConstraints in this situation?
(We use JPA2, JBoss 7.1)
@UniqueConstraint
only works for the generation of tables, – Cohesion