setMaxResults « Fetch « JPA Q&A





1. What is difference between setMaxResults and setFetchSize in org.hibernate.Query?    stackoverflow.com

What is difference between setMaxResults and setFetchSize in org.hibernate.Query? I just can no get it =)

2. duplicate object with left join fetch Paginate setMaxResults    forum.hibernate.org

I appreciate your response but I am trying to avoid having to move away from HQL. I am hoping that I do not have to rewrite a lot of code just because HQL does not handle pagination when dealing with duplicate objects resulting from a left join fetch query. The documentation is such: 10.4.1.5. Pagination If you need to specify bounds ...

3. query.setMaxResults() and join fetch    forum.hibernate.org

Hi, I'm using Hibernate for a while and I find it the best ORM solution I've ever seen. Now I'm facing the following problem: in my code I have a query like this: entityManager.createQuery("select book from Book book left join fetch book.authors").setMaxResults(10).getResultList(). I noticed that in case of join fetch setMaxResults() is ignored and the whole result set is loaded first ...

4. left join (fetch) + setMaxResults    forum.hibernate.org

Hi! A question to Hibernate gurus: what query strategy does latest hibernate use to implement max.results (SQL limit) with left join (fetch)? What are workarounds? "Hibernate in Action" says this is illegal, as max.results (SQL limit) will render the query inconsistent but notes that hibernate may fall silently to "workaround" strategies. Example: (from Cat c left join fetch c.kittens).setMaxResult(N); I want ...

5. setMaxResults and fetch="subselect"    forum.hibernate.org

Hibernate: select user0_.ID as ID0_, user0_.username as username0_, user0_.password as password0_, user0_.title as title0_, user0_.firstname as firstname0_, user0_.lastname as lastname0_, user0_.email as email0_, user0_.account_id as account8_0_ from USERS user0_ limit ? Hibernate: select products0_.user_id as user1_1_, products0_.product_Id as product2_1_, product1_.ID as ID3_0_, product1_.name as name3_0_, product1_.price as price3_0_ from USER_PRODUCTS products0_ left outer join PRODUCTS product1_ on products0_.product_Id=product1_.ID where products0_.user_id in ...

6. Does Hibernate retrieve all the records for setMaxResults?    forum.hibernate.org

If I use Hibernate criteria search as follows: criteria.setFirstResult(0); criteria.setMaxResults(5); return criteria.list(); Suppose there are 20 records meeting the criteria, and I know the above return returns the first 5 records. My question is: Does Hibernate get all records from the database, removes other records internally, and then return the first 5 record or Does the database only returns the first ...