title: How to override unique constraint defined in super class
body: <p>Below is the super class which looks something like this.</p>
  
  <pre><code>public abstract class BaseType {
  
      @Basic(optional = false)
      @Column(name = "code", length = 8, unique = true, nullable = false)
      private String code;
  
      .........
  
  }
  </code></pre>
  
  <p>And i have inherited this class and created an JPA Entity looks like this.</p>
  
  <pre><code>public class ChildEntity extends BaseType {
  
      @Basic(optional = false)
      @Column(name = "group_id", nullable = false)
      private Long groupId;
  
      ......
  }
  </code></pre>
  
  <p>I need to create a combination of "code" and "group_id" as a unique.</p>
  
  <p>I have tried adding uniqueConstraints but did not work. And only "code" is always considered as unique but not both.</p>
  
  <pre><code>@Table(name = "table_name", uniqueConstraints = @UniqueConstraint(columnNames = {
          "code", "group_id"}))
  </code></pre>
  
  <p>How can i override unique="true" defined in BaseType in the subclass.</p>
  
  <p>Please help.</p>