To specify a UniqueConstraint on multiple columns, i use the @Table annotation and specify the value for uniqueConstraint. I would also like to add a null constraint based on this scenario:
@Entity
public class Contact{
private PhoneBook phoneBook;
private ContactGroup group;
}
An entity can either be in a phoneBook, or in a group but not both, since a group already has a reference to phonebook it belongs to. In this case, both phonebook and group must both not be null and must both not be set, only one can be set at a time.
Working on netbeans 7.2, glassfish 3.2 eclipselink 2.0
Thanks.