Non-empty list with null elements returned from Hibernate query

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-06T06:31:02Z Indexed on 2010/05/06 7:28 UTC
Read the original article Hit count: 112

Filed under:
|
|

Hi,

I'm new to hibernate so not sure if this is an expected behaviour, anyway:

Session session = (Session)entityManager.getDelegate();
Criteria criteria = session.createCriteria(myRequest.class);
criteria.add(Restrictions.eq("username", username));
criteria.setProjection(Projections.max("accesscount"));
List<myRequest> results = criteria.list();

The returned results is a non-empty list with a single null element.

I can't think of any reason why it should behave this way, any idea if this is the expected behaviour or have I done something wrong?

System is on hibernate/Syabse.

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate