how to JOIN three tables using criteria api and metamodel
posted 2 years ago
I have three tables Lesson, Course, Program. Lesson has an attribute for Course's uuid, Course has an attribute for Program's uuid. How can I translate this to a Criteria API expression? Right now my statement returns a Path, and it's not returning any tuples.
I wrote out some sql to help me figure out what I needed to do. I think it should look something like this:
FROM Lesson AS l
INNER JOIN Course AS c
INNER JOIN Program AS p
WHERE p.uuid = 'LessonSearchCriteria.PROGRAM_ID'
I am creating a dynamic query method that can search by Program_ID and by other characteristics if needed. My code looks like this as of right now:
I have also tried using the String versions of the join and get methods. Thanks!