I have a SQL projection query that returns a list, but I want a single result. Here is my projection query:
Criteria criteria = getCurrentSession().createCriteria(TbLoyaltytrans.class) .add(Restrictions.eq("custid", custId)) .setProjection(Projections.projectionList() .add(Projections.sum("pointin").as("pointin")) .add(Projections.sum("pointout").as("pointout")) .add(Projections.sqlProjection( "(pointin - pointout) as points", new String[]{"points"}, new org.hibernate.type.DoubleType[]{ new org.hibernate.type.DoubleType() }), "points") ); I want a single object, i.e.: the count from the above query.
What I did wrong with the above query?