Skip to content

Commit a438474

Browse files
committed
add some javadoc
1 parent cbc5724 commit a438474

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ public interface Session extends SharedSessionContract, EntityManager {
183183
void setFlushMode(FlushModeType flushMode);
184184

185185
/**
186-
* Set the current {@link FlushMode flush mode} for this session.
186+
* Set the current {@linkplain FlushMode flush mode} for this session.
187187
* <p>
188188
* <em>Flushing</em> is the process of synchronizing the underlying persistent
189189
* store with persistable state held in memory. The current flush mode determines
190190
* when the session is automatically flushed.
191191
* <p>
192-
* The {@link FlushMode#AUTO default flush mode} is sometimes unnecessarily
192+
* The {@linkplain FlushMode#AUTO default flush mode} is sometimes unnecessarily
193193
* aggressive. For a logically "read only" session, it's reasonable to set the
194194
* session's flush mode to {@link FlushMode#MANUAL} at the start of the session
195195
* in order to avoid some unnecessary work.
@@ -201,22 +201,22 @@ public interface Session extends SharedSessionContract, EntityManager {
201201
void setHibernateFlushMode(FlushMode flushMode);
202202

203203
/**
204-
* Get the current {@link FlushModeType JPA flush mode} for this session.
204+
* Get the current {@linkplain FlushModeType JPA flush mode} for this session.
205205
*
206206
* @return the {@link FlushModeType} currently in effect
207207
*/
208208
@Override
209209
FlushModeType getFlushMode();
210210

211211
/**
212-
* Get the current {@link FlushMode flush mode} for this session.
212+
* Get the current {@linkplain FlushMode flush mode} for this session.
213213
*
214214
* @return the {@link FlushMode} currently in effect
215215
*/
216216
FlushMode getHibernateFlushMode();
217217

218218
/**
219-
* Set the current {@link CacheMode cache mode} for this session.
219+
* Set the current {@linkplain CacheMode cache mode} for this session.
220220
* <p>
221221
* The cache mode determines the manner in which this session can interact with
222222
* the second level cache.
@@ -226,7 +226,7 @@ public interface Session extends SharedSessionContract, EntityManager {
226226
void setCacheMode(CacheMode cacheMode);
227227

228228
/**
229-
* Get the current {@link CacheMode cache mode} for this session.
229+
* Get the current {@linkplain CacheMode cache mode} for this session.
230230
*
231231
* @return the current cache mode
232232
*/

hibernate-core/src/main/java/org/hibernate/query/CommonQueryContract.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,30 @@
2424
* forms of querying: HQL/JPQL queries, native SQL queries,
2525
* {@linkplain jakarta.persistence.criteria.CriteriaBuilder criteria queries}, and
2626
* {@linkplain org.hibernate.procedure.ProcedureCall stored procedure calls}.
27+
* <p>
28+
* Queries may have <em>parameters</em>, either ordinal or named, and the various
29+
* {@code setParameter()} operations of this interface allow an argument to be
30+
* bound to a parameter. It's not usually necessary to explicitly specify the type
31+
* of an argument, but in rare cases where this is needed, {@link TypedParameterValue}
32+
* may be used.
33+
* <p>
34+
* The operation {@link #setFlushMode(FlushModeType)} allows a temporary flush
35+
* mode to be specified, which is in effect only during the execution of this query.
36+
* Setting the {@linkplain FlushMode flush mode} at the query level does not affect
37+
* the flush mode of other operations performed via the parent {@linkplain Session
38+
* session}. This operation is usually used as follows:
39+
* <p>
40+
* <pre>query.setFlushMode(COMMIT).getResultList()</pre>
41+
* <p>
42+
* The call to {@code setFlushMode(COMMIT)} disables the usual automatic flush
43+
* operation that occurs before query execution.
2744
*
2845
* @author Steve Ebersole
2946
* @author Gavin King
47+
*
48+
* @see jakarta.persistence.Query
49+
* @see SelectionQuery
50+
* @see MutationQuery
3051
*/
3152
public interface CommonQueryContract {
3253

hibernate-core/src/main/java/org/hibernate/query/TypedParameterValue.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,35 @@
1010
import org.hibernate.type.BasicTypeReference;
1111

1212
/**
13-
* Can be used to bind query parameter values. Allows providing additional details about the
14-
* parameter value/binding.
13+
* Represents a typed argument to a query parameter.
14+
* <p>
15+
* Usually, the {@linkplain org.hibernate.type.Type Hibernate type} of
16+
* an argument to a query parameter may be inferred, and so it's rarely
17+
* necessary to explicitly pass a type when binding the argument.
18+
* Occasionally, and especially when the argument is null, the type
19+
* cannot be inferred and must be explicitly specified. In such cases,
20+
* an instance of {@code TypedParameterValue} may be passed to
21+
* {@link jakarta.persistence.Query#setParameter setParameter()}.
22+
* <p>
23+
* For example:
24+
* <pre>
25+
* query.setParameter("stringNamedParam",
26+
* new TypedParameterValue(StandardBasicTypes.STRING, null))
27+
* </pre>
28+
* <p>
29+
* Here, a "null string" argument was bound to the named parameter
30+
* {@code :stringNamedParam}.
1531
*
1632
* @author Steve Ebersole
33+
*
34+
* @since 6
35+
*
36+
* @see jakarta.persistence.Query#setParameter(int, Object)
37+
* @see jakarta.persistence.Query#setParameter(String, Object)
38+
* @see CommonQueryContract#setParameter(int, Object)
39+
* @see CommonQueryContract#setParameter(String, Object)
40+
*
41+
* @see org.hibernate.type.StandardBasicTypes
1742
*/
1843
public final class TypedParameterValue<J> {
1944

0 commit comments

Comments
 (0)