rowCount()
Criteria criteria = session.createCriteria(UserForm.class); //建立Criteria物件 criteria.add(Restrictions.eq("username","sk")); //設定查詢條件 criteria.setProjection(Projections.rowCount()); //查詢結果返回的行數 int value = (Integer)criteria.uniqueResult(); //獲取查詢結果 System.out.println("記錄數:"+value);