HHH-12185 - Simplify SessionFactoryBuilder / SessionFactoryOptions handling

Option #1 - still building a stand-alone, immutable options object
This commit is contained in:
Steve Ebersole 2017-12-21 09:14:44 -06:00
parent 829b33822f
commit 7baa9e4e06
8 changed files with 1341 additions and 1376 deletions

View File

@ -441,7 +441,10 @@ public interface SessionFactoryBuilder {
* @return {@code this}, for method chaining
*
* @see org.hibernate.cfg.AvailableSettings#JPAQL_STRICT_COMPLIANCE
*
* @deprecated Use {@link #enableJpaQueryCompliance} instead
*/
@Deprecated
SessionFactoryBuilder applyStrictJpaQueryLanguageCompliance(boolean enabled);
/**

View File

@ -99,7 +99,6 @@ public class SessionFactoryOptionsImpl implements SessionFactoryOptions {
// Queries
private final Map querySubstitutions;
private final boolean strictJpaQueryLanguageCompliance;
private final boolean namedQueryStartupCheckingEnabled;
private final boolean conventionalJavaConstants;
private final boolean procedureParameterNullPassingEnabled;
@ -186,7 +185,6 @@ public class SessionFactoryOptionsImpl implements SessionFactoryOptions {
this.currentTenantIdentifierResolver = state.getCurrentTenantIdentifierResolver();
this.querySubstitutions = state.getQuerySubstitutions();
this.strictJpaQueryLanguageCompliance = state.isStrictJpaQueryLanguageCompliance();
this.namedQueryStartupCheckingEnabled = state.isNamedQueryStartupCheckingEnabled();
this.conventionalJavaConstants = state.isConventionalJavaConstants();
this.procedureParameterNullPassingEnabled = state.isProcedureParameterNullPassingEnabled();
@ -396,11 +394,6 @@ public class SessionFactoryOptionsImpl implements SessionFactoryOptions {
return querySubstitutions;
}
@Override
public boolean isStrictJpaQueryLanguageCompliance() {
return strictJpaQueryLanguageCompliance;
}
@Override
public boolean isNamedQueryStartupCheckingEnabled() {
return namedQueryStartupCheckingEnabled;

View File

@ -211,11 +211,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp
return delegate.getQuerySubstitutions();
}
@Override
public boolean isStrictJpaQueryLanguageCompliance() {
return delegate.isStrictJpaQueryLanguageCompliance();
}
@Override
public boolean isNamedQueryStartupCheckingEnabled() {
return delegate.isNamedQueryStartupCheckingEnabled();

View File

@ -165,7 +165,14 @@ public interface SessionFactoryOptions {
Map getQuerySubstitutions();
boolean isStrictJpaQueryLanguageCompliance();
/**
* @deprecated Use {@link JpaCompliance#isJpaQueryComplianceEnabled()} instead
* via {@link #getJpaCompliance()}
*/
@Deprecated
default boolean isStrictJpaQueryLanguageCompliance() {
return getJpaCompliance().isJpaQueryComplianceEnabled();
}
boolean isNamedQueryStartupCheckingEnabled();

View File

@ -89,7 +89,6 @@ public final class Settings {
LOG.debugf( "JTA Track by Thread: %s", enabledDisabled( sessionFactoryOptions.isJtaTrackByThread() ) );
LOG.debugf( "Query language substitutions: %s", sessionFactoryOptions.getQuerySubstitutions() );
LOG.debugf( "JPA query language strict compliance: %s", enabledDisabled( sessionFactoryOptions.isStrictJpaQueryLanguageCompliance() ) );
LOG.debugf( "Named query checking : %s", enabledDisabled( sessionFactoryOptions.isNamedQueryStartupCheckingEnabled() ) );
LOG.debugf( "Second-level cache: %s", enabledDisabled( sessionFactoryOptions.isSecondLevelCacheEnabled() ) );
@ -109,6 +108,11 @@ public final class Settings {
LOG.debugf( "JDBC result set fetch size: %s", sessionFactoryOptions.getJdbcFetchSize() );
LOG.debugf( "Connection release mode: %s", sessionFactoryOptions.getConnectionReleaseMode() );
LOG.debugf( "Generate SQL with comments: %s", enabledDisabled( sessionFactoryOptions.isCommentsEnabled() ) );
LOG.debugf( "JPA compliance - query : ", enabledDisabled( sessionFactoryOptions.getJpaCompliance().isJpaQueryComplianceEnabled() ) );
LOG.debugf( "JPA compliance - closed-handling : ", enabledDisabled( sessionFactoryOptions.getJpaCompliance().isJpaClosedComplianceEnabled() ) );
LOG.debugf( "JPA compliance - lists : ", enabledDisabled( sessionFactoryOptions.getJpaCompliance().isJpaListComplianceEnabled() ) );
LOG.debugf( "JPA compliance - transactions : ", enabledDisabled( sessionFactoryOptions.getJpaCompliance().isJpaTransactionComplianceEnabled() ) );
}
}
@ -207,10 +211,6 @@ public final class Settings {
return sessionFactoryOptions.getQuerySubstitutions();
}
public boolean isStrictJPAQLCompliance() {
return sessionFactoryOptions.isStrictJpaQueryLanguageCompliance();
}
public boolean isNamedQueryStartupCheckingEnabled() {
return sessionFactoryOptions.isNamedQueryStartupCheckingEnabled();
}

View File

@ -419,6 +419,6 @@ public class SessionFactoryHelper {
}
public boolean isStrictJPAQLComplianceEnabled() {
return sfi.getSessionFactoryOptions().isStrictJpaQueryLanguageCompliance();
return sfi.getSessionFactoryOptions().getJpaCompliance().isJpaQueryComplianceEnabled();
}
}