I have an entity Tutor with two relationships in class Schedule. Code below defines the relationship between the two entities.
public class Tutor{
//list of schedules created by tutor
@OneToMany
List<Schedule> schedules;
}
then
public class Schedule{
//tutor who created this schedule
@ManyToOne
Tutor tutor;
//tutors who would be examiners of this schedule
@ManyToMany
@JoinTable
List<Tutor> examiners;
}
how can i query Tutor and fetch all Schedule(s) where Tutor is an examiner using criteria api