Skip to content

Commit 485cf80

Browse files
committed
HHH-19830 - Use of markdown for Javadoc
Couple of changes to test effect on building on CI
1 parent 0f41601 commit 485cf80

File tree

6 files changed

+280
-344
lines changed

6 files changed

+280
-344
lines changed

hibernate-core/src/main/java/org/hibernate/EnabledFetchProfile.java

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,60 @@
77
import jakarta.persistence.FindOption;
88
import org.hibernate.query.SelectionQuery;
99

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-
* &#064;Entity
21-
* &#064;FetchProfile(name = "WithAuthors")
22-
* class Book {
23-
* ...
24-
*
25-
* &#064;ManyToMany
26-
* &#064;FetchProfileOverride(profile = Book_.PROFILE_WITH_AUTHORS)
27-
* Set&lt;Author&gt; 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
6364
public record EnabledFetchProfile(String profileName)
6465
implements FindOption {
6566

hibernate-core/src/main/java/org/hibernate/IdentifierLoadAccess.java

Lines changed: 56 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,88 +12,73 @@
1212
import jakarta.persistence.Timeout;
1313
import org.hibernate.graph.GraphSemantic;
1414

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.
5146
@Deprecated(since = "7.1", forRemoval = true)
5247
public interface IdentifierLoadAccess<T> {
5348

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
6154
default IdentifierLoadAccess<T> with(LockMode lockMode) {
6255
return with( lockMode, PessimisticLockScope.NORMAL );
6356
}
6457

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
7364
IdentifierLoadAccess<T> with(LockMode lockMode, PessimisticLockScope lockScope);
7465

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
8371
IdentifierLoadAccess<T> with(Timeout timeout);
8472

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.
9782
@Deprecated(since = "7.0", forRemoval = true)
9883
IdentifierLoadAccess<T> with(LockOptions lockOptions);
9984

hibernate-core/src/main/java/org/hibernate/SessionBuilder.java

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,38 @@
1212
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
1313
import org.hibernate.resource.jdbc.spi.StatementInspector;
1414

15-
/**
16-
* Allows creation of a new {@link Session} with specific options
17-
* overriding the defaults from the {@link SessionFactory}.
18-
* <pre>
19-
* try (var session =
20-
* sessionFactory.withOptions()
21-
* .tenantIdentifier(tenantId)
22-
* .initialCacheMode(CacheMode.PUT)
23-
* .flushMode(FlushMode.COMMIT)
24-
* .interceptor(new Interceptor() {
25-
* &#64;Override
26-
* public void preFlush(Iterator&lt;Object&gt; entities) {
27-
* ...
28-
* }
29-
* })
30-
* .openSession()) {
31-
* ...
32-
* }
33-
* </pre>
34-
*
35-
* @author Steve Ebersole
36-
*
37-
* @see SessionFactory#withOptions()
38-
* @see SharedSessionBuilder
39-
*/
15+
/// Allows creation of a new [Session] with specific options
16+
/// overriding the defaults from the [SessionFactory].
17+
///
18+
/// ```java
19+
/// try (var session = sessionFactory.withOptions()
20+
/// .tenantIdentifier(tenantId)
21+
/// .initialCacheMode(CacheMode.PUT)
22+
/// .flushMode(FlushMode.COMMIT)
23+
/// .interceptor(new Interceptor() {
24+
/// @Override
25+
/// public void preFlush(Iterator<Object> entities) {
26+
/// ...
27+
/// }
28+
/// })
29+
/// .openSession()) {
30+
/// ...
31+
/// }
32+
/// }
33+
/// @author Steve Ebersole
34+
///
35+
/// @see SessionFactory#withOptions()
36+
/// @see SharedSessionBuilder
4037
public interface SessionBuilder extends CommonBuilder {
41-
/**
42-
* Opens a session with the specified options.
43-
*
44-
* @return The session
45-
*/
38+
/// Open the session using the specified options.
39+
/// @see #open
4640
Session openSession();
4741

42+
@Override
43+
default Session open() {
44+
return openSession();
45+
}
46+
4847
@Override
4948
SessionBuilder interceptor(Interceptor interceptor);
5049

0 commit comments

Comments
 (0)