size « Fetch « JPA Q&A

1. Hibernate fetch size

2. fetch_size

4. Unable to retrieve a collection but can get the size

Hibernate version: 2.1.7b Mapping documents: Code: ...


Need help with Hibernate? Read this first: ... AskForHelp Hibernate version: 3.0.3 Mapping documents: false org.hibernate.dialect.DB2Dialect 2 2 org.hibernate.connection.C3P0ConnectionProvider 10 0

6. How does setFetchSize(int size) work exactly?

When applied to a criteria.list() the list size returned is the size of the entire list (ie larger than the fetch size) but there are only as many items as the fetchSize specifies. Are all the elements returned to the jvm or does the database hand back only the elements to the list?

7. fetch only the size of a collection (one-to-many)

Is there a way of fetching only the size of a collection in a one to many association? For example: I have UserPojo with a collection of FonePojo. Can I use lazy for the one-to-many association and retrieve only the count of FonePojo without loading all related objects? For example: load(userPojo); userPojo.getfones.size(); //retrieves the number of items but does not initialize ...

8. Ways to eager fetch collection but restrict its size?

Hibernate version: 3.2.3 Mapping documents: Code:

9. Criteria to fetch entity's set size

my entity object contains a set. Normally if i want the number of elements i would call the size() function. How do i impliment this with criteria? this will be used for ordering the results. I can cheat and create a counter, and do the order by that column name desc... but i bet there is a "nicer" way of doing ...