From ed213d7cdf3f811fdd8177788c4d1acd21ca0fb0 Mon Sep 17 00:00:00 2001 From: Gavin Date: Sun, 21 May 2023 10:24:06 +0200 Subject: [PATCH] add applySubselectFetchEnabled() to builder improve some Javadoc --- .../org/hibernate/boot/SessionFactoryBuilder.java | 15 +++++++++++++-- .../boot/internal/SessionFactoryBuilderImpl.java | 6 ++++++ .../AbstractDelegatingSessionFactoryBuilder.java | 6 ++++++ .../java/org/hibernate/cfg/AvailableSettings.java | 8 +++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java index aae26df31f..09ed7032fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java @@ -304,8 +304,19 @@ public interface SessionFactoryBuilder { SessionFactoryBuilder applyMaximumFetchDepth(int depth); /** - * Apply a null precedence (NULLS FIRST, NULLS LAST) to be applied to - * order by clauses rendered in SQL queries. + * Enable the use of subselect fetching. + * + * @param enabled {@code true} indicates that subselect fetching is enabled + * + * @return {@code this}, for method chaining + * + * @see org.hibernate.cfg.AvailableSettings#USE_SUBSELECT_FETCH + */ + SessionFactoryBuilder applySubselectFetchEnabled(boolean enabled); + + /** + * Apply a null precedence, {@code NULLS FIRST} or {@code NULLS LAST}, + * to {@code order by} clauses rendered in SQL queries. * * @param nullPrecedence The default null precedence to use. * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java index e29ece41fa..53d3fd498c 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java @@ -230,6 +230,12 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement return this; } + @Override + public SessionFactoryBuilder applySubselectFetchEnabled(boolean enabled) { + this.optionsBuilder.applySubselectFetchEnabled( enabled ); + return this; + } + @Override public SessionFactoryBuilder applyDefaultNullPrecedence(NullPrecedence nullPrecedence) { this.optionsBuilder.applyDefaultNullPrecedence( nullPrecedence ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilder.java index df34075fba..2194d65bb1 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilder.java @@ -178,6 +178,12 @@ public abstract class AbstractDelegatingSessionFactoryBuilder + * By default, Hibernate only uses batch fetching for associations + * explicitly annotated {@code @BatchSize}. * * @see org.hibernate.annotations.BatchSize * @see org.hibernate.boot.SessionFactoryBuilder#applyDefaultBatchFetchSize(int) @@ -1040,6 +1045,7 @@ public interface AvailableSettings { * explicitly annotated {@code @Fetch(SUBSELECT)}. * * @see org.hibernate.annotations.FetchMode#SUBSELECT + * @see org.hibernate.boot.SessionFactoryBuilder#applySubselectFetchEnabled(boolean) */ String USE_SUBSELECT_FETCH = "hibernate.use_subselect_fetch";