I have a sql query:
select * from A
INNER JOIN B
ON A.id = B.id
INNER JOIN C
ON B.id = C.id
INNER JOIN D
ON C.id = D.id
where D.name = 'XYZ'
and D.Sex = 'M'
I have been trying to come with hibernate query criteria for the above sql, but having problems. Could anybody help out.
On your question you want to perform a Cartesian Join, and this is not supported by Criteria, although you can do it with HQL as show below. There is a similar question here
With HQL query you could do something like:
The query is used in a regular hibernate query: