Code:
@Entity
public class Person implements Serializable {
private int id;
...........
private Set<Languages> languages = new HashSet<Languages>();
...............
@ManyToMany
@JoinTable(name = "link_person_languages")
public Set<Languages> getLanguages() {
return languages;
}
}
@Entity
public class Languages implements Serializable {
private int id;
private String name;
@Id
@GeneratedValue
public int getId() {
return id;
}
@Column(nullable = false, length = 40, unique = true)
public String getName() {
return name;
}
Lets say i have Languages Eng Germ, People who speaks Eng, people who speaks German, and people who speaks Eng and German I want to get all of the people who speaks English and German using Criteria.
please help i am really desperate...