Skip to content

Commit bb40606

Browse files
committed
javadoc for LazyCollectionOption
1 parent 5160ac3 commit bb40606

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

hibernate-core/src/main/java/org/hibernate/annotations/LazyCollection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
* {@link jakarta.persistence.OneToMany} or
1717
* {@link jakarta.persistence.ManyToMany} association,
1818
* or an {@link jakarta.persistence.ElementCollection}.
19-
* <p>
2019
* This is an alternative to specifying the JPA
21-
* {@link jakarta.persistence.FetchType}.
20+
* {@link jakarta.persistence.FetchType}. This annotation
21+
* is used to enable {@linkplain LazyCollectionOption#EXTRA
22+
* extra-lazy collection fetching}.
2223
*
2324
* @author Emmanuel Bernard
2425
*/

hibernate-core/src/main/java/org/hibernate/annotations/LazyCollectionOption.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,38 @@
77
package org.hibernate.annotations;
88

99
/**
10-
* Lazy options available for a collection.
10+
* Enumerates the options for lazy loading of a
11+
* {@linkplain jakarta.persistence.ElementCollection collection},
12+
* {@linkplain jakarta.persistence.ManyToOne many to one association},
13+
* or {@linkplain jakarta.persistence.ManyToMany many to many association}.
1114
*
1215
* @author Emmanuel Bernard
16+
*
17+
* @see LazyCollection
1318
*/
1419
public enum LazyCollectionOption {
1520
/**
16-
* Eagerly load it.
21+
* The collection is always loaded eagerly, and all its
22+
* elements are available immediately. However, access to
23+
* the collection is still mediated by an instance of
24+
* {@link org.hibernate.collection.spi.PersistentCollection},
25+
* which tracks modifications to the collection.
1726
*/
1827
FALSE,
1928
/**
20-
* Load it when the state is requested.
29+
* The underlying Java collection is proxied by an instance of
30+
* {@link org.hibernate.collection.spi.PersistentCollection}
31+
* and lazily fetched when a method of the proxy is called.
32+
* All elements of the collection are retrieved at once.
2133
*/
2234
TRUE,
2335
/**
24-
* Prefer extra queries over full collection loading.
36+
* The underlying Java collection is proxied by an instance of
37+
* {@link org.hibernate.collection.spi.PersistentCollection}
38+
* and its state is fetched lazily from the database as needed,
39+
* when methods of the proxy are called. When reasonable, the
40+
* proxy will avoid fetching all elements of the collection
41+
* at once.
2542
*/
2643
EXTRA
2744
}

0 commit comments

Comments
 (0)