title: Specifying restrictions "unique together" in Hibernate
body: <p>I have an entity where I want to specify a restriction that two fields should have a unique pair value. E.g. one field is owner, another is name, I want a restriction that the combination of (owner,name) should be unique. But I do not want to make these a composite primary key:</p>
  
  <pre><code>@Entity
  @Table(name="keyfile")
  public class KeyFile {
  
     @Id @GeneratedValue(strategy=GenerationType.AUTO)
     private Long id;
     @ManyToOne @ForeignKey(name="FK_SIGNATUREID_USER")
     private User owner;
     @Column(nullable=false,length=80)
     private String name;
  }
  </code></pre>
  
  <p>How do I specify this restriction with a Hibernate annotation?</p>