Hi! I'm just new to Hibernate. I've a question with fetching collections. I'm solving the following problem: ex. I've table User and it is associated with tables Address, Email, Phone. I need to get information about all users (about 1.000.000) so I need to retrieve some fields from associated tables (ex. Address.Street Address.City, etc.) for each user. Now it takes too many time because of number of queries to database. So I have an idea to reduce number of queries by fetching addresses, phones, emails in query where I get users, but it's impossible to do just like "... left outer join fetch user.addresses ..." because query is limited to get users by 1000 not to get OutOfMemory error.
Using Hibernate 3.2.6.ga and Hibernate annotations 3.3.0. Database - MySQL 5.0 (InnoDB)
Can you help me on how to solve this problem and reduce execution time?
Thank's a lot!
|