JPA - (Association) Fetch

> JPA - Java Persistence API (JPA)

1 - 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.


3 - 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.

4 - Documentation / Reference