How to do multiple column UniqueConstraint in hbm?
Posted
by DataSurfer
on Stack Overflow
See other posts from Stack Overflow
or by DataSurfer
Published on 2010-04-29T22:02:40Z
Indexed on
2010/04/29
22:07 UTC
Read the original article
Hit count: 262
Working on some legacy hibernate code.
How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations?
@Table(name="users", uniqueConstraints = {
@UniqueConstraint(columnNames={"username", "client"}),
@UniqueConstraint(columnNames={"email", "client"})
})
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private int id;
private String username;
private String email;
private Client client;
}
© Stack Overflow or respective owner