Relationship Prefetching

In many cases when an entity bean’s state is fetched from
the database, its relationship fields are always accessed in the same
transaction. Relationship prefetching saves database round trips by
fetching data for an entity bean and those beans referenced by its
CMR fields in a single database round trip.

To enable relationship prefetching for a CMR field, use the default subelement of the fetched-with element
in the sun-cmp-mappings.xml file. By default, these
CMR fields are prefetched whenever findByPrimaryKey or
a custom finder is executed for the entity, or when the entity is
navigated to from a relationship. (Recursive prefetching is not supported,
because it does not usually enhance performance.) See fetched-with in Sun GlassFish Enterprise Server v2.1.1 Application Deployment Guide.