24.2.44. @LazyCollection
The @LazyCollection
annotation is used to specify the lazy fetching behavior of a given collection.
The possible values are given by the [LazyCollectionOption](https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/annotations/LazyCollectionOption.html)
enumeration:
</div>
Load it when the state is requested.
</dd>
Eagerly load it.
</dd>
Prefer extra queries over full collection loading.
</dd> </dl> </div>
The TRUE
and FALSE
values are deprecated since you should be using the JPA FetchType
attribute of the @ElementCollection
, @OneToMany
, or @ManyToMany
collection.
</div>
The EXTRA
value has no equivalent in the JPA specification, and it’s used to avoid loading the entire collection even when the collection is accessed for the first time.
Each element is fetched individually using a secondary query.
</div> </div>