Hello all,
in a product export scenario, I need to initialize products from a query result set with a large amount of rows (say up to 100.000).
Products have 6 different collections of dependent objects each, so I cannot use join fetching to initialize the collections (cartesian product).
So hibernate initializes collections per product with individual selects, which is way too slow.
My first approach would be to issue queries with join for each of the collections, then iterate all 6 queries in parallel and initialize collection objects from these query results.
Problem is that the where clause of all queries is identical and quite complex (query objects satisfying view definition spread over several tables).
Is it possible to reuse basic query for the different joins that need to be performed on the results?
Are there solutions that give better performance?
|