JPA - (Association) Fetch

Card Puncher Data Processing

JPA - (Association) Fetch


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.


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

Discover More
Jpa Mapping Method
JPA - Entity Annotations

A key feature of EJB 3.0 and JPA is the ability to create entities that contain object-relational mappings by using (metadata) annotations rather than deployment descriptors (orm.xml) as in earlier versions....
One To Many Hello Data Model
JPA - How to define a @One-to-Many relationship ?

To define a one-to-many relationship, the following annotation is used @OneToMany. The Interface with parameters and default values: where: targetEntity is the entity class that is the target...

Share this page:
Follow us:
Task Runner