I have started learning Spring Boot recently. I was building a REST API backend where I need to show a list of courses depending upon the provided list of teachers. In other words, I need to fetch all the courses C1, C2 etc. where Teachers say A, B, and C are enrolled in. The SQL query which I need to feed into Repository Class method is as given below-
SELECT * FROM MyDB.course_teacher
where teacher_id="TCH_00023"
or teacher_id="TCH_00024"
or teacher_id="TCH_00034"
order by course_id DESC;
The method defined in the Repository Class is
@Query(value="",nativeQuery=true)
List<Courses> fetchCourseByTeachersList(List<String> teacherIds);
Now, how do I pass the teacher IDs from the argument list in the query value? Please advice.