Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how to JOIN three tables using criteria api and metamodel

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

SELECT *
FROM Lesson AS l
INNER JOIN Course AS c
ON l.Course=c.uuid
INNER JOIN Program AS p
ON c.program=p.uuid
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!
 
Your mother is a hamster and your father smells of tiny ads!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic