@Entity
public class Employee {
@Id @GeneratedValue
private long id;
@Index
private String name;
// other fields and methods
}
@Entity
@IdClass(EmployeeId.class)
public class Employee {
@Id @GeneratedValue
private long id;
@Id @Index
private String department;
// other fields and methods
}
@Entity
public class Employee {
@Id @GeneratedValue
private long id;
@Index(unique=true)
private String email;
// other fields and methods
}