Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HQL complex left joins and WITH clause  RSS feed

 
Kanat Serikbayev
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, everyone

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?
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There were some JIRA's with this functionality breaking in certain versions of hibernate. What are receiptStatus and receiptStatusLns?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!