1
如何在Hibernate條件中添加「限制值」。如何通過在條件中使用限制來限制結果數據
我的代碼是這樣的
Criteria criteria = session.createCriteria(Sample.class);
criteria.add(Restrictions.eq("colOne", colOne));
criteria.add(Restrictions.eq("colThree", colThree));
criteria.addOrder(Order.desc("colFour"));
如何檢索單個行,而不是一個列表?
使用'setMaxResults()'(或'uniqueResult()') –
uniqueResult作爲結果是一個列表,而不是唯一的引發錯誤 – Jazmin