I'm using Hibernate as a JPA implementation and I didn't manage to make a comination of multiple columns unique.
Code:
@Entity
@Table(name = "EXAMPLE")
public class Test implements Serializable{
private static final long serialVersionUID = -7104819378300361520L;
@Id
@GeneratedValue
@Column(name = "id")
private Long id = null;
@Column(name = "cond1", length = 30, nullable = false)
private boolean cond1;
@Column(name = "cond2", nullable = false)
private boolean cond2;
}
In a handwritten mysql ddl statement it would be something like
create table( id int auto_increment, primary key(id), cond1 boolean not null, cond2 boolean not null, unique(cond1,cond2));
thx in advance