|
12 | 12 | import jakarta.persistence.Timeout; |
13 | 13 | import org.hibernate.graph.GraphSemantic; |
14 | 14 |
|
15 | | -/** |
16 | | - * Loads an entity by its primary identifier. |
17 | | - * <p> |
18 | | - * The interface is especially useful when customizing association |
19 | | - * fetching using an {@link jakarta.persistence.EntityGraph}. |
20 | | - * <pre> |
21 | | - * var graph = session.createEntityGraph(Book.class); |
22 | | - * graph.addSubgraph(Book_.publisher); |
23 | | - * graph.addPluralSubgraph(Book_.authors) |
24 | | - * .addSubgraph(Author_.person); |
25 | | - * |
26 | | - * Book book = |
27 | | - * session.byId(Book.class) |
28 | | - * .withFetchGraph(graph) |
29 | | - * .load(bookId); |
30 | | - * </pre> |
31 | | - * <p> |
32 | | - * It's also useful for loading entity instances with a specific |
33 | | - * {@linkplain CacheMode cache interaction mode} in effect, or in |
34 | | - * {@linkplain Session#setReadOnly(Object, boolean) read-only mode}. |
35 | | - * <pre> |
36 | | - * Book book = |
37 | | - * session.byId(Book.class) |
38 | | - * .with(CacheMode.GET) |
39 | | - * .withReadOnly(true) |
40 | | - * .load(bookId); |
41 | | - * </pre> |
42 | | - * |
43 | | - * @author Eric Dalquist |
44 | | - * @author Steve Ebersole |
45 | | - * |
46 | | - * @see Session#byId |
47 | | - * |
48 | | - * @deprecated Use forms of {@linkplain Session#find} accepting |
49 | | - * {@linkplain jakarta.persistence.FindOption} instead of {@linkplain Session#byId}. |
50 | | - */ |
| 15 | +/// Loads an entity by its primary identifier. |
| 16 | +/// |
| 17 | +/// The interface is especially useful when customizing association |
| 18 | +/// fetching using an [jakarta.persistence.EntityGraph]. |
| 19 | +/// ```java |
| 20 | +/// var graph = session.createEntityGraph(Book.class); |
| 21 | +/// graph.addSubgraph(Book_.publisher); |
| 22 | +/// graph.addPluralSubgraph(Book_.authors) |
| 23 | +/// .addSubgraph(Author_.person); |
| 24 | +/// Book book = session.byId(Book.class) |
| 25 | +/// .withFetchGraph(graph) |
| 26 | +/// .load(bookId); |
| 27 | +/// ``` |
| 28 | +/// |
| 29 | +/// It's also useful for loading entity instances with a specific |
| 30 | +/// [cache interaction mode][CacheMode] in effect, or in |
| 31 | +/// [read-only mode][Session#setReadOnly(Object, boolean)]. |
| 32 | +/// |
| 33 | +/// ```java |
| 34 | +/// Book book = session.byId(Book.class) |
| 35 | +/// .with(CacheMode.GET) |
| 36 | +/// .withReadOnly(true) |
| 37 | +/// .load(bookId); |
| 38 | +/// ``` |
| 39 | +/// |
| 40 | +/// @author Eric Dalquist |
| 41 | +/// @author Steve Ebersole |
| 42 | +/// |
| 43 | +/// @see Session#byId |
| 44 | +/// |
| 45 | +/// @deprecated Use forms of [Session#find] accepting [jakarta.persistence.FindOption]} instead. |
51 | 46 | @Deprecated(since = "7.1", forRemoval = true) |
52 | 47 | public interface IdentifierLoadAccess<T> { |
53 | 48 |
|
54 | | - /** |
55 | | - * Specify the {@linkplain LockMode lock mode} to use when |
56 | | - * querying the database. |
57 | | - * |
58 | | - * @param lockMode The lock mode to apply |
59 | | - * @return {@code this}, for method chaining |
60 | | - */ |
| 49 | + /// Specify the [lock mode][LockMode] to use when querying the database. |
| 50 | + /// |
| 51 | + /// @param lockMode The lock mode to apply |
| 52 | + /// |
| 53 | + /// @return `this`, for method chaining |
61 | 54 | default IdentifierLoadAccess<T> with(LockMode lockMode) { |
62 | 55 | return with( lockMode, PessimisticLockScope.NORMAL ); |
63 | 56 | } |
64 | 57 |
|
65 | | - /** |
66 | | - * Specify the {@linkplain LockMode lock mode} to use when |
67 | | - * querying the database. |
68 | | - * |
69 | | - * @param lockMode The lock mode to apply |
70 | | - * |
71 | | - * @return {@code this}, for method chaining |
72 | | - */ |
| 58 | + /// Specify the [lock mode][LockMode] and [scope][PessimisticLockScope] to use when querying the database. |
| 59 | + /// |
| 60 | + /// @param lockMode The lock mode to apply |
| 61 | + /// @param lockScope The locking scope (how much to lock). |
| 62 | + /// |
| 63 | + /// @return `this`, for method chaining |
73 | 64 | IdentifierLoadAccess<T> with(LockMode lockMode, PessimisticLockScope lockScope); |
74 | 65 |
|
75 | | - /** |
76 | | - * Specify the {@linkplain Timeout timeout} to use when |
77 | | - * querying the database. |
78 | | - * |
79 | | - * @param timeout The timeout to apply to the database operation |
80 | | - * |
81 | | - * @return {@code this}, for method chaining |
82 | | - */ |
| 66 | + /// Specify the [timeout][Timeout] to use when querying the database. |
| 67 | + /// |
| 68 | + /// @param timeout The timeout to apply to the database operation |
| 69 | + /// |
| 70 | + /// @return `this`, for method chaining |
83 | 71 | IdentifierLoadAccess<T> with(Timeout timeout); |
84 | 72 |
|
85 | | - /** |
86 | | - * Specify the {@linkplain LockOptions lock options} to use when |
87 | | - * querying the database. |
88 | | - * |
89 | | - * @param lockOptions The lock options to use |
90 | | - * |
91 | | - * @return {@code this}, for method chaining |
92 | | - * |
93 | | - * @deprecated Use one of {@linkplain #with(LockMode)}, |
94 | | - * {@linkplain #with(LockMode, PessimisticLockScope)} |
95 | | - * and/or {@linkplain #with(Timeout)} instead. |
96 | | - */ |
| 73 | + /// Specify the [lock options][LockOptions] to use when querying the database. |
| 74 | + /// |
| 75 | + /// @param lockOptions The lock options to use |
| 76 | + /// |
| 77 | + /// @return `this`, for method chaining |
| 78 | + /// |
| 79 | + /// @deprecated Use one of [#with(LockMode)], |
| 80 | + /// [#with(LockMode, PessimisticLockScope)] |
| 81 | + /// and/or [#with(Timeout)] instead. |
97 | 82 | @Deprecated(since = "7.0", forRemoval = true) |
98 | 83 | IdentifierLoadAccess<T> with(LockOptions lockOptions); |
99 | 84 |
|
|
0 commit comments