fyi: between hibernate 3 and 4 the meaning of setMaxResults(0) changed from returning 0 to all records and this is not documented as well as far as I know. So I guess some changes between the versions you have to live with.