When Criteria.DISTINCT_ROOT_ENTITY used, hibernate can't paging query?
Code:
Criteria crit = dao.getSession().createCriteria(Ingredient.class);
crit.createAlias("contents", "ct");
crit.createAlias("ct.products", "pd");
crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
System.out.println("total:"+crit.list().size());
int offset = 0;
int perPage = 15;
crit.setFirstResult(offset);
crit.setMaxResults(perPage);
List list = crit.list();
System.out.println("list size in page:"+list.size());
this result is .
Code:
total:12615
list size in page : 2
'list size in page' value changed accoring to page no ( offset )
is it hibernate's bug?
note. I must use crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
[/code]