hibernate.max_fetch_depth
Sets a maximum "depth" for the outer join fetch tree for single-ended associations (one-to-one, many-to-one).
Experiment with values between 1 (default) and 4. The larger the value, the bigger the cartesian product and more complex the join query.
Note: This parameter has no relevance to HQL queries. This property has its impact on Get, Load, ICriteria and graph travelral queries only.
Optimize Lazy Associations
Lazy associations are of following types:
- Immediate: After fetching the key columns, additional select queries are issued to the DB to select the related data.
- Lazy: Only the key is loaded by Hibernate. When the property is accessed in the code, additional queries are issued to the DB.
- Eager (Outer Join) fetching: Load the column values from related tables using outer-join query.
Use Report Queries for loading only selected columns
select
new my.package.MyItemRow(item.id, item.Description, bid.Amount)
from Item item join item.Bids bid
where bid.Amount > 100
Cache
Second-level Cache
Configure meta-data tables to second-level cache so they are never fetched from the DB.
Query Cache
The results of a query are cached in memory. When the same query is executed again, the result identifiers are fetched from the cache.
|