I'm completely new to Hibernate and at the moment I'm stuck with a task to convert a native query to HQL.
I'm using Hibernate 4.1.6. The query contains a lot of left joins. I'm having a problem with a left join that has a reference to the previous left join.
This is how the native query looks like:
Specifically I'm having problems with this line
Hibernate provides WITH clause that can be used instead of ON. So I rewrote the query the following way:
However, for some reason it seems to be not possible to reference the previous left join in this case (WITH rSL.locale = oSL.locale).
I get an exception stating
org.hibernate.hql.internal.ast.InvalidWithClauseException: with clause can only reference columns in the driving table
Am I doing something wrong? Or is that a limitation of HQL? If it's a limitation, is there a workaround to solve this problem?