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?