How to get distinct results in hibernate with joins and row-based limiting?

Posted by Daniel Alexiuc on Stack Overflow See other posts from Stack Overflow or by Daniel Alexiuc
Published on 2008-11-18T23:05:13Z Indexed on 2010/04/16 11:13 UTC
Read the original article Hit count: 359

Filed under:
|
|
|
|

I'm trying to implement paging using row-based limiting (for example: setFirstResult(5) and setMaxResults(10)) on a Hibernate Criteria query that has joins to other tables.

Understandably, data is getting cut off randomly; and the reason for that is explained here.

As a solution, the page suggests using a "second sql select" instead of a join.

How can I convert my existing criteria query (which has joins using createAlias()) to use a nested select instead?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about paging