我在执行查询时遇到错误。错误是:
java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:从第1行第84列开始[来自com.services.om.entity.OrderLines,其中orderNumber in(:order_Numbers)开始with parentLineIdentifier由前一个orderLineIdentifier = parentLineIdentifier]为空连接
我的DAO代码是:
public List<OrderLineVO> findAllOrders(List<BigDecimal> orderNumbers) throws OrderManagementException {
try{
String getAllOrders = "from OrderLines where orderNumber in (:order_Numbers) order by orderDate desc ";
Query query = em.createQuery(getAllOrders,OrderLines.class);
query.setParameter("order_Numbers", orderNumbers);
List<OrderLines> orderLinesList = query.getResultList();
String queryParentChild = "from OrderLines where orderNumber in (:order_Numbers) start with parentLineIdentifier is null connect by prior orderLineIdentifier = parentLineIdentifier";
Query queryParent = em.createQuery(queryParentChild, OrderLines.class);
queryParent.setParameter("order_Numbers", orderNumbers);
List<OrderLines> orderLinesList2 = queryParent.getResultList();
return OrderLineUTIL.getOrderLines(orderLinesList);
}catch(Exception exception){
logger.error(exception.getMessage());
throw new OrderManagementException(exception.getMessage());
}
}
em.createQuery(queryParentChild, OrderLines.class); // Line is giving above error.
有任何建议吗?
此外,查询中正确标记了实体类字段变量。