JOIN with multiple OR in HQL

143 views Asked by At

Below is a SQL query with multiple joins and conditions which gives the desired output, I want to convert the below query to HQL

select * from customer c 
join customer_geo_rel cg on c.id=cg.customer_id
join geography g on cg.geo_id=g.id   
join geo_geo_hierarchy gghCluster on g.id = gghCluster.geo_id
join geo_geo_hierarchy gghDivision on gghCluster.geo_id = gghDivision.parent_geo_id   
join role_data_rel rdr on gghCluster.geo_id = rdr.permission_data_id OR   
gghDivision.parent_geo_id = rdr.permission_data_id OR   
g.id=rdr.permission_data_id
1

There are 1 answers

4
Christian Beikov On BEST ANSWER

What's the problem? HQL supports the ON clause for joins and if you use a very old version of Hibernate, you can use the WITH clause like e.g. .. join g.roleDataRelList rds on ...