Hi all
I'm very new to Hibernate can someone please tell me what am I doing wrong with this query;
Code:
@NamedQuery(name = "PurchaseOrder.findAll", query = "SELECT p FROM PurchaseOrder p ORDER BY p.purchaseOrderDate DESC")
@Formula(value = "(select sum(pot.TRAN_QUANTITY) FROM PURCHASE_ORDER_PROD_TRAN pot, PURCHASE_ORDER p where p.PURCHASE_ORDER_ID = pot.PURCHASE_ORDER_ID group by p.PURCHASE_ORDER_ID)")
private int purchaseOrderQuantity;
I'm using the same query in SQL developer (using SQL syntax) it works fine, but here I'm getting this error;
Quote:
java.sql.SQLException: ORA-01427: single-row subquery returns more than one row
Any thoughts anyone????