Browsing index pages (2 articles)
↧
JPA - defining multi-column unique constraints
Is it possible using JPA to define multiple unique constraints.@Entityclass Foo { long id; String name; MyEnum type;}Foo.id should be unique as should combinations of {Foo.name, Foo.type}.Ex.id, name,...
View ArticleAnswer by JB Nizet for JPA - defining multi-column unique constraints
With the uniqueConstraints attribute of the Table annotation:@Table(name = "FOO", uniqueConstraints={ @UniqueConstraint(columnNames = {"NAME", "TYPE"})})
View Article
Browsing index pages (2 articles)