|
7 | 7 | import jakarta.persistence.FindOption; |
8 | 8 | import org.hibernate.query.SelectionQuery; |
9 | 9 |
|
10 | | -/** |
11 | | - * A {@link jakarta.persistence.FindOption} which requests a named |
12 | | - * {@linkplain org.hibernate.annotations.FetchProfile fetch profile}. |
13 | | - * <p> |
14 | | - * An instance of this class may be obtained in a type safe way |
15 | | - * from the static metamodel for the class annotated |
16 | | - * {@link org.hibernate.annotations.FetchProfile @FetchProfile}. |
17 | | - * <p> |
18 | | - * For example, this class defines a fetch profile: |
19 | | - * <pre> |
20 | | - * @Entity |
21 | | - * @FetchProfile(name = "WithAuthors") |
22 | | - * class Book { |
23 | | - * ... |
24 | | - * |
25 | | - * @ManyToMany |
26 | | - * @FetchProfileOverride(profile = Book_.PROFILE_WITH_AUTHORS) |
27 | | - * Set<Author> authors; |
28 | | - * } |
29 | | - * </pre> |
30 | | - * <p> |
31 | | - * An {@code EnabledFetchProfile} may be obtained from the static |
32 | | - * metamodel for the entity {@code Book} and passed as an option to |
33 | | - * {@link Session#find(Class, Object, FindOption...) find()}. |
34 | | - * <pre> |
35 | | - * Book bookWithAuthors = |
36 | | - * session.find(Book.class, isbn, Book_._WithAuthors) |
37 | | - * </pre> |
38 | | - * Alternatively, it may be {@linkplain #enable(Session) applied} |
39 | | - * to a {@code Session} or {@code Query}. |
40 | | - * <pre> |
41 | | - * Book_._WithAuthors.enable(session); |
42 | | - * Book bookWithAuthors = session.find(Book.class, isbn); |
43 | | - * </pre> |
44 | | - * <p> |
45 | | - * When the static metamodel is not used, an {@code EnabledFetchProfile} |
46 | | - * may be instantiated directly, passing the name of the fetch profile |
47 | | - * as a string. |
48 | | - * <pre> |
49 | | - * Book bookWithAuthors = |
50 | | - * session.find(Book.class, isbn, |
51 | | - * new EnabledFetchProfile("WithAuthors")) |
52 | | - * </pre> |
53 | | - * |
54 | | - * @param profileName the {@linkplain org.hibernate.annotations.FetchProfile#name profile name} |
55 | | - * |
56 | | - * @since 7.0 |
57 | | - * |
58 | | - * @see org.hibernate.annotations.FetchProfile |
59 | | - * @see Session#find(Class, Object, FindOption...) |
60 | | - * |
61 | | - * @author Gavin King |
62 | | - */ |
| 10 | +/// A [jakarta.persistence.FindOption] which represents a named |
| 11 | +/// [fetch profile][org.hibernate.annotations.FetchProfile]. |
| 12 | +/// |
| 13 | +/// An instance of this class may be obtained in a type safe way |
| 14 | +/// from the static metamodel for the class annotated with the |
| 15 | +/// [@FetchProfile][org.hibernate.annotations.FetchProfile]. |
| 16 | +/// |
| 17 | +/// For example, this class defines a fetch profile: |
| 18 | +/// ```java |
| 19 | +/// @Entity |
| 20 | +/// @FetchProfile(name = "WithAuthors") |
| 21 | +/// class Book { |
| 22 | +/// ... |
| 23 | +/// @ManyToMany |
| 24 | +/// @FetchProfileOverride(profile = Book_.PROFILE_WITH_AUTHORS) |
| 25 | +/// Set<Author> authors; |
| 26 | +/// } |
| 27 | +/// ``` |
| 28 | +/// |
| 29 | +/// An `EnabledFetchProfile` may be obtained from the static |
| 30 | +/// metamodel for the entity {@code Book} and passed as an option to |
| 31 | +/// [Session#find(Class, Object, FindOption...)]. |
| 32 | +/// |
| 33 | +/// ```java |
| 34 | +/// Book bookWithAuthors = |
| 35 | +/// session.find(Book.class, isbn, Book_._WithAuthors) |
| 36 | +/// ``` |
| 37 | +/// |
| 38 | +/// Alternatively, it may be [applied][#enable(Session)] |
| 39 | +/// to a `Session` or `Query`. |
| 40 | +/// |
| 41 | +/// ```java |
| 42 | +/// Book_._WithAuthors.enable(session); |
| 43 | +/// Book bookWithAuthors = session.find(Book.class, isbn); |
| 44 | +/// ``` |
| 45 | +/// |
| 46 | +/// When the static metamodel is not used, an `EnabledFetchProfile` |
| 47 | +/// may be instantiated directly, passing the name of the fetch profile |
| 48 | +/// as a string. |
| 49 | +/// |
| 50 | +/// ```java |
| 51 | +/// Book bookWithAuthors = |
| 52 | +/// session.find(Book.class, isbn, |
| 53 | +/// new EnabledFetchProfile("WithAuthors")) |
| 54 | +/// ``` |
| 55 | +/// |
| 56 | +/// @param profileName the [profile name][org.hibernate.annotations.FetchProfile#name]. |
| 57 | +/// |
| 58 | +/// @since 7.0 |
| 59 | +/// |
| 60 | +/// @see org.hibernate.annotations.FetchProfile |
| 61 | +/// @see Session#find(Class, Object, FindOption...) |
| 62 | +/// |
| 63 | +/// @author Gavin King |
63 | 64 | public record EnabledFetchProfile(String profileName) |
64 | 65 | implements FindOption { |
65 | 66 |
|
|
0 commit comments