java - Hibernate criteria API: only one result -
i have problems hibernate criteria api. want rows of table objects, limit amount of returned results. here code:
criteria c = session.createcriteria(user.class); c.setfirstresult(start); c.setmaxresults(end-start); c.setresulttransformer(criteria.distinct_root_entity); list<user> test = c.list();
first result in case 0 , max results 10. there 3 users in db. problem first row of database in result list. if don't use resulttransformer, first row 10 times (maxresults) in list. if dont't use max results , resulttransformer, first row 100 times in result list.
if add restriction specific user, result list contains specific user, clear not first row found because of strange circumstances.
please help, i'm clueless.