我已经在休眠中使用 Criteria 进行了查询,它工作正常。
代码:
List<HmsInventoryStockDetail> stockList = null;
Criteria crt = session.createCriteria(HmsInventoryStockDetail.class);
crt.createAlias("itemMaster", "item");
if (!itemName.equals("")) {
crt.add(Restrictions.eq("item.itemName", itemName));
}
if (!itemType.equals("")) {
crt.add(Restrictions.eq("item.itemTypeMaster.itemType", itemType));
}
if (!manufacturerName.equals("")) {
crt.add(Restrictions.eq("item.manufacturerMaster.manufacturerName", manufacturerName));
}
if (!batchNumber.equals("")) {
crt.add(Restrictions.eq("batchNumber", batchNumber));
}
if (!rackNo.equals("")) {
crt.add(Restrictions.eq("item.rackMaster.rackNo", rackNo));
}
if (expiryDate != null) {
crt.add(Restrictions.le("expiryDate", expiryDate));
}
stockList = crt.list();
但我需要此声明的并行 Hql 查询。谢谢