JPA - (Association) Fetch

About

The fetch attribute is a enum that specifies whether to load the field's persisted data:

  • before the entity object is returned by the persistence provider (FetchType.EAGER)
  • or later, when the property is accessed (FetchType.LAZY).

The default behavior is:

In most cases, the default behavior is the most sensible approach.

Management

The PersistenceUtil.isLoaded methods can be used to determine the load state of an entity and its attributes regardless of the persistence unit with which the entity is associated.

Documentation / Reference


Powered by ComboStrap