-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: with-clause referenced two different from-clause elements:
PostPosted: Wed Jul 11, 2007 1:11 am 
Newbie

Joined: Wed Mar 14, 2007 2:21 am
Posts: 5
I recently upgraded my hibernate from 3.2.1.ga to 3.2.4.sp1. Following query which worked fine with previous hibernate throws exception with new hibernate:

Code:
select new com.wsi.mm.model.directship.vo.ItemDirectShipSearchResultVO (item.id,
            item.description, item.style.id, directShipItemAttribute )
              from ItemImpl item
              join item.department department
            join department.group bannerGroup with bannerGroup.id=:bannerId
            left outer join item.directShipItemAttributes directShipItemAttribute
              with directShipItemAttribute.class=DirectShipItemAttribute


Some criteria are added to this query on the fly. Following exception is thrown:

Code:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: with-clause referenced two different from-clause elements:
[select new com.wsi.mm.model.directship.vo.ItemDirectShipSearchResultVO (item.id, item.description, item.style.id, directShipItemAttribute ) from com.wsi.mm.model.item.ItemImpl item join item.department department join department.group bannerGroup with bannerGroup.id=:bannerId left outer join item.directShipItemAttributes directShipItemAttribute with directShipItemAttribute.class=DirectShipItemAttribute and  directShipItemAttribute.banner=:directShipItemAttribute_banner  and  directShipItemAttribute.supplier=:directShipItemAttribute_supplier  join item.itemSuppliers itemSupplier with itemSupplier.class = DirectShipItemSupplier  and  itemSupplier.supplier.id=:itemSupplier_supplier_id where ( item.itemLevel = item.transactionLevel and item.statusCode = 'A'  and  item.id=:item_id  ) ]


Can someone plz help me get rid of this exception?


Top
 Profile  
 
 Post subject: issue using WITH clause
PostPosted: Mon Feb 02, 2009 11:30 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
It looks like your criteria
Code:
directShipItemAttribute.supplier=:directShipItemAttribute_supplier
could be the issue for you.

I had a very similar issue today, but the workaround in this JIRA (http://opensource.atlassian.com/projects/hibernate/browse/HHH-2772) resolved the issue for me. Is this bug fixed in newer versions or does it still exist (as the JIRA would indicate)?

For anyone searching for this in the future, I was getting "with-clause referenced two different from-clause elements" and
Code:
org.hibernate.hql.ast.InvalidWithClauseException: with clause can only reference columns in the driving table


Cheers,

Damian.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.