I have a SQL query which is is querying multiple tables and has group by, order by and subqueries. I have tried to tune the query as much as possible. It has proper indexing on the columns. However, it takes time to execute and causes time out in the web application. If I limit the number of records by rownum<100, it is quick. Can we get complete records in group of fix number of records and map to pojo objects. Is there any way in Hibernate to do so.