0
@Entity
public class Person{
private String firstName;
private String lastName;
@OneToMany(mappedBy="person" , fetch= FetchType.LAZY)
private Set<Certificate> certificates;
}
@Entity
public class Certificate{
private String courseName;
@ManyToOne
@JoinColumn(name="person_id")
private Person person;
}
eine Einheit class(Person)
,, die eine Sammlung (Set) von verbundenen Unternehmen (Zertifikat) hält, wie oben @OneToMany
abgebildet werden. Nun muss ich all Persons having certificate.courseName IN ("OCPJP", "OCPWCD").
JPQL, wo Zustand auf Set mit Werteliste
holen In Simple SQL wird meine Abfrage so sein.
select distinct p.firstName, p.lastName from Person p join Certificate c on p.Id = c.person_Id
where c.courseName IN ("OCPJP", "OCPWCD")
Wie bekomme ich eine ähnliche Ausgabe in JPQL?