xjodoin/torpedoquery — Issue #14: Not all named parameters have been set
Author: adaher
Created: 2012-01-16 22:21:38+00:00
State: open

Bug reported between 1.2.1 and 1.3.1

@Override
public Map findNumberOfReceivedPurchase(List orderIds)
{
List list = orderDashBoardQueryBuilder.generateNumberOfReceivedPurchaseQuery(orderIds).list(getEntityManager());

final Map numberOfRequisitionMap = generateMap(list);
return numberOfRequisitionMap;
}

@Override
public Query generateNumberOfReceivedPurchaseQuery(List orderIds)
{

final OrderDetail fromOrderDetail = from(OrderDetail.class);
final PurchaseRequisition innerJoinPurchaseRequisition = innerJoin(fromOrderDetail.getPurchaseRequisitions());
final PurchaseOrderDetail leftJoinpurchaseOrderDetail = leftJoin(innerJoinPurchaseRequisition.getPurchaseOrderDetail());
final PurchaseOrderDetailToReceive innerJoinPurchaseOrderDetailToReceive = innerJoin(leftJoinpurchaseOrderDetail.getPurchaseOrderDetailToReceive());
final ReceivingDetail innerJoinReceivingDetail = innerJoin(innerJoinPurchaseOrderDetailToReceive.getReceptions());
final Receiving innerJoinReceiving = innerJoin(innerJoinReceivingDetail.getReceiving());
final DocumentStatus innerJoindocumentStatus = innerJoin(innerJoinReceiving.getDocumentStatus());
final Order innerJoinOrder = innerJoin(fromOrderDetail.getSaleTransaction());

final OnGoingLogicalCondition condition = condition(innerJoinPurchaseOrderDetailToReceive.isForcedComplete()).eq(true);

final OnGoingLogicalCondition where = where(innerJoinReceiving.isReversed()).eq(false);

where.and(innerJoinReceiving.getReverse()).isNull();
where.and(innerJoindocumentStatus.getInternalId()).neq(DocumentStatus.CANCEL);

groupBy(innerJoinOrder.getId()).having(sum(innerJoinReceivingDetail.getQuantityConvertedValue()))
.gte(sum(innerJoinPurchaseRequisition.getQuantityConvertedValue())).or(condition);

Query select = select(count(innerJoinReceivingDetail), innerJoinOrder.getId());

return select;
}

==============================================
STACK TRACE
==============================================
Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: Not all named parameters have been set: [forcedComplete_10] [select count(*), order_1.id from OrderDetail orderDetail_0 inner join orderDetail_0.purchaseRequisitions purchaseRequisition_2 left join purchaseRequisition_2.purchaseOrderDetail purchaseOrderDetail_3 inner join purchaseOrderDetail_3.purchaseOrderDetailToReceive purchaseOrderDetailToReceive_4 inner join purchaseOrderDetailToReceive_4.receptions receivingDetail_5 inner join receivingDetail_5.receiving receiving_6 inner join receiving_6.documentStatus documentStatus_7 inner join orderDetail_0.saleTransaction order_1 where receiving_6.reversed = :reversed_8 and receiving_6.reverse is null and documentStatus_7.internalId <> :internalId_9 group by order_1.id having sum(receivingDetail_5.quantityConvertedValue) >= sum(purchaseRequisition_2.quantityConvertedValue) or ( purchaseOrderDetailToReceive_4.forcedComplete = :forcedComplete_10 )]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
at org.torpedoquery.jpa.internal.QueryBuilder.list(QueryBuilder.java:257)
at com.netappsid.erp.dashboard.server.order.utils.mapmanager.OrderDashBoardMapManager.findNumberOfReceivedPurchase(OrderDashBoardMapManager.java:99)
at com.netappsid.erp.dashboard.server.order.utils.mapmanager.OrderDashBoardDataMapManager.generateDataInMaps(OrderDashBoardDataMapManager.java:76)
at com.netappsid.erp.dashboard.server.order.services.beans.OrderDashBoardServicesBean.generateOrderDashBoard(OrderDashBoardServicesBean.java:91)
... 11 more
Caused by: org.hibernate.QueryException: Not all named parameters have been set: [forcedComplete_10] [select count(*), order_1.id from OrderDetail orderDetail_0 inner join orderDetail_0.purchaseRequisitions purchaseRequisition_2 left join purchaseRequisition_2.purchaseOrderDetail purchaseOrderDetail_3 inner join purchaseOrderDetail_3.purchaseOrderDetailToReceive purchaseOrderDetailToReceive_4 inner join purchaseOrderDetailToReceive_4.receptions receivingDetail_5 inner join receivingDetail_5.receiving receiving_6 inner join receiving_6.documentStatus documentStatus_7 inner join orderDetail_0.saleTransaction order_1 where receiving_6.reversed = :reversed_8 and receiving_6.reverse is null and documentStatus_7.internalId <> :internalId_9 group by order_1.id having sum(receivingDetail_5.quantityConvertedValue) >= sum(purchaseRequisition_2.quantityConvertedValue) or ( purchaseOrderDetailToReceive_4.forcedComplete = :forcedComplete_10 )]
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:315)
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:299)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:98)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
... 15 more