public String getVoucherPinByCategoryTypeDeno(String category, String type, double denomination) {
return (String) sessionFactory.getCurrentSession().createQuery("from voucher v where v.category = :category and v.voucherType = :type and v.denomination = :denomination").setparameter().uniqueResult();
}
答案 0 :(得分:2)
您需要这样的查询
Voucher voucher = (Voucher) session.createQuery("from Voucher v where v.category = :category and v.voucherType = :type and v.denomination = :denomination")
.setString("category", category)
.setString("voucherType", type)
.setDouble("denomination", denomination)
.uniqueResult();