[b]Hibernate version:[/b] 2.x
I'm having a lot of difficulty working out how to do joins using criteria queries. My understanding of criteria queries is that when you call createCriteria(class), the class you give it is the persistant class that you want the data to be returned as an instance of. I want to do a query that returns a list of objects that contains data from two different tables, associated by an inner join.
As an example, if I have two tables with the attributes:
PERSON
- personId
- name
- departmentId
DEPARTMENT
- departmentId
- name
And I have an object that will go to my web front end that contains the following data to be rendered:
Webform
- personName
- departmentName
how do i use criteria queries to return a list of Webform's created by an SQL query that joins person to department by departmentid?
|