It's a dum down version of a real problem
I have Three Tables STUDENT
ADDRESS
CLASS
STUDENT ManyToOne ADDRESS
STUDENT ManyToMany CLASS
I need to bring all the students who have same address and go to same class.
Sql would simply be (just writing this on the fly and have not tested it)
Select * from STUDENT s join ADDRESS a on s.addressId = a.addressId join CLASS c on c.classId = s.classId
Now I am new to Criteria and while have been able use it reasonbly so far , I am totally stuck as how should I do this join have looked every where documentation by Oracle , Jboss etc but no indication on how this should be done and all the stabs I have taken in the dark have been unsuccessful. Even on SO there are many questions in similar tone but when you read them it is something else thats being ask.