@Entity @Table(name = "region", indexes = {@Index(name = "my_index_name", columnList="iso_code", unique = true), @Index(name = "my_index_name2", columnList="name", unique = false)}) public class Region{ @Column(name = "iso_code", nullable = false) private String isoCode; @Column(name = "name", nullable = false) private String name; }
or
@Entity @Table(name = "company__activity", indexes = {@Index(name = "i_company_activity", columnList = "activity_id,company_id")}) public class CompanyActivity{
References
http://stackoverflow.com/questions/3405229/specifying-an-index-non-unique-key-using-jpa