diff --git a/hibernate-core/src/main/java/org/hibernate/IdentifierLoadAccess.java b/hibernate-core/src/main/java/org/hibernate/IdentifierLoadAccess.java index 083b7609b8..269eb84565 100644 --- a/hibernate-core/src/main/java/org/hibernate/IdentifierLoadAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/IdentifierLoadAccess.java @@ -104,8 +104,28 @@ default IdentifierLoadAccess with(RootGraph graph) { */ IdentifierLoadAccess with(RootGraph graph, GraphSemantic semantic); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be enabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ IdentifierLoadAccess enableFetchProfile(String profileName); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be disabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ IdentifierLoadAccess disableFetchProfile(String profileName); /** diff --git a/hibernate-core/src/main/java/org/hibernate/NaturalIdLoadAccess.java b/hibernate-core/src/main/java/org/hibernate/NaturalIdLoadAccess.java index 7b79fa52da..bf4ad3c70a 100644 --- a/hibernate-core/src/main/java/org/hibernate/NaturalIdLoadAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/NaturalIdLoadAccess.java @@ -44,8 +44,28 @@ public interface NaturalIdLoadAccess { */ NaturalIdLoadAccess with(LockOptions lockOptions); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be enabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ NaturalIdLoadAccess enableFetchProfile(String profileName); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be disabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ NaturalIdLoadAccess disableFetchProfile(String profileName); /** diff --git a/hibernate-core/src/main/java/org/hibernate/SimpleNaturalIdLoadAccess.java b/hibernate-core/src/main/java/org/hibernate/SimpleNaturalIdLoadAccess.java index 6683e070c8..8991a65889 100644 --- a/hibernate-core/src/main/java/org/hibernate/SimpleNaturalIdLoadAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/SimpleNaturalIdLoadAccess.java @@ -37,8 +37,28 @@ public interface SimpleNaturalIdLoadAccess { */ SimpleNaturalIdLoadAccess with(LockOptions lockOptions); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be enabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ SimpleNaturalIdLoadAccess enableFetchProfile(String profileName); + /** + * Customize the associations fetched by specifying a + * {@linkplain org.hibernate.annotations.FetchProfile fetch profile} + * that should be disabled during this operation. + *

+ * This allows the {@linkplain Session#isFetchProfileEnabled(String) + * session-level fetch profiles} to be temporarily overridden. + * + * @since 6.3 + */ SimpleNaturalIdLoadAccess disableFetchProfile(String profileName); /**