-1

I have a DAO method:

     Criteria crit = statelessSession.createCriteria(APRecord.class, "apr");
     crit.createAlias("mAId", "mId", Criteria.INNER_JOIN);

     rit.setProjection(Projections.projectionList()
        .add(Projections.groupProperty("pName"), "pName")
        .add(Projections.groupProperty("kNum"), "kNum")
        .add(Projections.countDistinct("agentG"), "count"));

           return crit.scroll(ScrollMode.FORWARD_ONLY);

This returns me an error:

      java.lang.ClassCastException: java.lang.String cannot be cast to test.model.AR.APRecord

Anyone know what the error is? any help appreciated

Jay
  • 471
  • 1
  • 4
  • 11

1 Answers1

0

I think the problem lies in this line:

Criteria crit = statelessSession.createCriteria(APRecord.class, "apr");

Basically you are trying to cast a string "apr" to APRecord.class

You can find here some examples for criteria usages.

Ivan
  • 297
  • 1
  • 6