aspose file tools*
The moose likes Object Relational Mapping and the fly likes HQL complex left joins and WITH clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL complex left joins and WITH clause" Watch "HQL complex left joins and WITH clause" New topic
Author

HQL complex left joins and WITH clause

Kanat Serikbayev
Greenhorn

Joined: Sep 13, 2012
Posts: 1
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

Joined: Mar 07, 2010
Posts: 1666
    
    7

There were some JIRA's with this functionality breaking in certain versions of hibernate. What are receiptStatus and receiptStatusLns?


[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HQL complex left joins and WITH clause