您好
我想寫SELECT SUM(cevecoin) FROM coin where clid="ABC";
但一直都沒辦法成功 可以幫我看看嗎? 謝謝
code如下
@Override
public Integer SumCoin(String Clid) {
CriteriaBuilder builder =getSession().getCriteriaBuilder();
CriteriaQuery<CoinBean> criteria =builder.createQuery(CoinBean.class);
Root<CoinBean> root = criteria.from(CoinBean.class);
builder.sum(root.get("Clid"));
return
getSession().createQuery(criteria).getSingleResult().getCevecoin();
}