3.4.2. Outer Join Fetching
If your database supports ANSI, Oracle or Sybase style outer joins, outer join fetching will often increase performance by limiting the number of round trips to and from the database. This is, however, at the cost of possibly more work performed by the database itself. Outer join fetching allows a whole graph of objects connected by many-to-one, one-to-many, many-to-many and one-to-one associations to be retrieved in a single SQL
SELECT
.
Outer join fetching can be disabled globally by setting the property
hibernate.max_fetch_depth
to 0
. A setting of 1
or higher enables outer join fetching for one-to-one and many-to-one associations that have been mapped with fetch="join"
.
See Section 19.1, “Fetching strategies” for more information.