Hi, I am trying to execute a HQL query which has an outer join. It is giving an exception. Can someone help me correct the query?
Code
Code:
public static final String FIND_DELIVERYNOTE_LINEITEM_ETA_SHIFTS =
" SELECT s.suppDelNoteLineItemId, s.spicsPartNumber, s.revisedEtaDate, po.dcaupPurchaseOrderId, " +
" po.originalEtaDate, pli.quantityOrdered, v1.spicsCustomerNumber " +
" FROM SupplierDeliveryNoteLineItemDO s " +
" LEFT OUTER JOIN " +
" FROM CustomerBackOrderTempDO c " +
" WHERE c.spicsBoOrderTypeNumber IN ( " +
" SELECT sot.spicsOrderTypeNumber " +
" FROM SpicsCustomerOrderTypeDO sot, OrderTypeDO ot " +
" WHERE ot.orderTypeId = sot.orderType.orderTypeId " +
" AND ot.orderTypeCode IN ('39', '38')) AS v1 " +
" ON (s.spicsPartNumber = v1.spicsPartNumber " +
" AND s.deliveryNoteLineNumber = v1.lineNumber), DcaupPurchaseOrderLineItemDO pli, DcaupPurchaseOrderDO po " +
" WHERE s.dcaupPoLineItemFid = pli.dcaupPoLineItemId " +
" AND pli.purchaseOrder.dcaupPurchaseOrderId = po.dcaupPurchaseOrderId " +
" AND s.notificationFlag = 'N' " +
" AND s.revisedEtaDate IS NOT NULL " +
" AND s.etaVariation IS NOT NULL " +
" ORDER BY (v1.spicsCustomerNumber) ";
Session session = getSession();
Query query = session.createQuery(FIND_DELIVERYNOTE_LINEITEM_ETA_SHIFTS);
Exception
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: FROM near line 1, column 247
[ SELECT s.suppDelNoteLineItemId, s.spicsPartNumber, s.revisedEtaDate, po.dcaupPurchaseOrderId, po.originalEtaDate,
pli.quantityOrdered, v1.spicsCustomerNumber FROM com.dcx.wppaup.shared.domain.SupplierDeliveryNoteLineItemDO s
LEFT OUTER JOIN FROM com.dcx.wppaup.shared.domain.CustomerBackOrderTempDO c WHERE c.spicsBoOrderTypeNumber IN
( SELECT sot.spicsOrderTypeNumber FROM com.dcx.wppaup.shared.domain.SpicsCustomerOrderTypeDO sot,
com.dcx.wppaup.shared.domain.OrderTypeDO ot WHERE ot.orderTypeId = sot.orderType.orderTypeId AND
ot.orderTypeCode IN ('39', '38')) AS v1 ON (s.spicsPartNumber = v1.spicsPartNumber AND
s.deliveryNoteLineNumber = v1.lineNumber), com.dcx.wppaup.shared.domain.DcaupPurchaseOrderLineItemDO pli,
com.dcx.wppaup.shared.domain.DcaupPurchaseOrderDO po WHERE s.dcaupPoLineItemFid = pli.dcaupPoLineItemId AND
pli.purchaseOrder.dcaupPurchaseOrderId = po.dcaupPurchaseOrderId AND s.notificationFlag = 'N' AND s.revisedEtaDate IS
NOT NULL AND s.etaVariation IS NOT NULL ORDER BY (v1.spicsCustomerNumber) ]
Thanks,
SSR