Skip to content

Commit 7e2f359

Browse files
committed
add @apiNotes about purpose of JPA hints
1 parent 50f851f commit 7e2f359

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,25 @@ public interface Session extends SharedSessionContract, EntityManager {
12661266
*/
12671267
void addEventListeners(SessionEventListener... listeners);
12681268

1269+
/**
1270+
* Set a hint. The hints understood by Hibernate are enumerated by
1271+
* {@link org.hibernate.jpa.AvailableHints}.
1272+
*
1273+
* @see org.hibernate.jpa.HibernateHints
1274+
* @see org.hibernate.jpa.SpecHints
1275+
*
1276+
* @apiNote Hints are a
1277+
* {@linkplain jakarta.persistence.EntityManager#setProperty
1278+
* JPA-standard way} to control provider-specific behavior of the
1279+
* {@code EntityManager}. Clients of the native API defined by
1280+
* Hibernate should make use of type-safe operations of this
1281+
* interface. For example, {@link #enableFetchProfile(String)}
1282+
* should be used in preference to the hint
1283+
* {@link org.hibernate.jpa.HibernateHints#HINT_FETCH_PROFILE}.
1284+
*/
1285+
@Override
1286+
void setProperty(String propertyName, Object value);
1287+
12691288
/**
12701289
* Create a new mutable instance of {@link EntityGraph}, with only
12711290
* a root node, allowing programmatic definition of the graph from

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ public interface CommonQueryContract {
180180
*
181181
* @see org.hibernate.jpa.HibernateHints
182182
* @see org.hibernate.jpa.SpecHints
183+
*
184+
* @apiNote Hints are a
185+
* {@linkplain jakarta.persistence.Query#setHint(String, Object)
186+
* JPA-standard way} to control provider-specific behavior
187+
* affecting execution of the query. Clients of the native API
188+
* defined by Hibernate should make use of type-safe operations
189+
* of this interface and of its subtypes. For example,
190+
* {@link SelectionQuery#setCacheRegion} is preferred over
191+
* {@link org.hibernate.jpa.HibernateHints#HINT_CACHE_REGION}.
183192
*/
184193
CommonQueryContract setHint(String hintName, Object value);
185194

0 commit comments

Comments
 (0)