谁能帮助我将此查询转换为HQL
SELECT
supplierOrderDetails.productID,
supplierOrderDetails.orderQty,
supplierOrderReceiveDetail.qtyArrived
FROM
supplierOrder
INNER JOIN
supplierOrderDetails
ON
(supplierOrderDetails.supplierOrderID = supplierOrder.ID)
INNER JOIN
supplierOrderReceive
ON
(supplierOrderReceive.supplierOrderID = supplierOrder.ID)
INNER JOIN
supplierOrderReceiveDetail
ON
(supplierOrderReceiveDetail.supplierOrderReceiveID = supplierOrderReceive.ID)
AND
(supplierOrderReceiveDetail.ProductID =supplierOrderDetails.ProductID)
WHERE supplierOrder.ID = 1
这是表的关系
最佳答案
我为那些想知道如何在HQL中联接多个表的人添加了查询
SELECT supplierOrderDetails.productID as product, supplierOrderDetails.orderQty as orderedQty,sum(supplierOrderReceiveDetail.qtyArrived) as qtyArrived
FROM SupplierOrder as so, SupplierOrderDetails as supplierOrderDetails, SupplierOrderReceiveDetail as supplierOrderReceiveDetail, SupplierOrderReceive as supplierOrderReceive
INNER JOIN supplierOrderDetails.supplierOrderID
INNER JOIN supplierOrderReceive.supplierOrder
INNER JOIN supplierOrderReceiveDetail.supplierOrderReceive
GROUP BY supplierOrderDetails.productID, supplierOrderDetails.orderQty