Interface JdbcSettings
- All Superinterfaces:
AgroalSettings,C3p0Settings,HikariCPSettings
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhether access to JDBC metadata is allowed during bootstrap.static final StringControls the autocommit mode of JDBC connections obtained from anyConnectionProviderimplementation which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.static final StringSpecifies how Hibernate should manage JDBC connections in terms of acquisition and release, either: an instance of the enumerationPhysicalConnectionHandlingMode, or the name of one of its instances.static final StringDeprecated.static final StringSpecifies aConnectionProviderto use for obtaining JDBC connections, either: a short strategy name likeagroal,hikaricp,c3p0, an instance ofConnectionProvider, aClassobject representing a class that implementsConnectionProvider, or the name of a class that implementsConnectionProvider.static final StringIndicates that connections obtained from the configuredConnectionProviderhave auto-commit already disabled when they are acquired.static final StringDeprecated.The JPA-standard "jakarta.persistence.jtaDataSource" or "jakarta.persistence.nonJtaDataSource" setting are now preferred.static final StringSpecifies the Hibernate SQL dialect, either an instance ofDialect, aClassrepresenting a class that extendsDialect, or the name of a class that extendsDialect.static final StringDeprecated.UseJAKARTA_HBM2DDL_DB_MAJOR_VERSIONinsteadstatic final StringDeprecated.UseJAKARTA_HBM2DDL_DB_MINOR_VERSIONinsteadstatic final StringDeprecated.UseJAKARTA_HBM2DDL_DB_NAMEinsteadstatic final StringDeprecated.UseJAKARTA_HBM2DDL_DB_VERSIONinsteadstatic final StringControls whether to use JDBC markers (`?`) or dialect native markers for parameters within preparable SQL statements.static final StringSpecifies additionalDialectResolverimplementations to register with the standardDialectFactory.static final StringDeprecated.The JPA-standard settingJAKARTA_JDBC_DRIVERis now preferred.static final StringEnables formatting of SQL logged to the console.static final StringDeprecated.UseJAKARTA_HBM2DDL_CONNECTIONinsteadstatic final StringEnables highlighting of SQL logged to the console using ANSI escape codes.static final StringSpecifies the JDBC transaction isolation level for connections obtained from anyConnectionProviderimplementation which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.static final StringAllows passing a specificConnectioninstance to be used bySchemaManagementToolfor the purpose of determining theDialect, and for performingdatabase actionsif requested.static final StringUsed in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.static final StringUsed in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.static final StringSpecifies the name of the database vendor (as would be reported byDatabaseMetaData.getDatabaseProductName()) for the purpose of determining theDialectto use.static final StringUsed in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.static final StringSpecifies the name of a JDBC driver to use to connect to the database.static final StringSpecifies the password to use when connecting via JDBC.static final StringSpecifies the JDBC connection URL to use to connect to the database.static final StringSpecifies the database user to use when connecting via JDBC.static final StringSpecifies a JTADataSourceto use for Connections.static final StringSpecifies a non-JTADataSourceto use for Connections.static final StringSpecifies the time zone to use in the JDBC driver, which is supposed to match the database timezone.static final StringDeprecated.UseJAKARTA_JDBC_DRIVERinsteadstatic final StringDeprecated.UseJAKARTA_JDBC_PASSWORDinsteadstatic final StringDeprecated.UseJAKARTA_JDBC_URLinsteadstatic final StringDeprecated.UseJAKARTA_JDBC_USERinsteadstatic final StringDeprecated.UseJAKARTA_JTA_DATASOURCEinsteadstatic final StringDeprecated.UseJAKARTA_NON_JTA_DATASOURCEinsteadstatic final StringWhen enabled, specifies that JDBC errors should be logged before being rethrown.static final StringWhen enabled, specifies that JDBC statement warnings should be logged.static final StringSpecifies a duration in milliseconds defining the minimum query execution time that characterizes a "slow" query.static final StringWhen enabled, specifies that Hibernate should not use contextual LOB creation.static final StringDeprecated.The JPA-standard settingJAKARTA_JDBC_PASSWORDis now preferred.static final StringSpecifies the maximum number of inactive connections for any connection pool which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.static final StringEnables logging of generated SQL to the console.static final StringGives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.static final StringSpecifies aStatementInspectorimplementation associated with theSessionFactory, either: an instance ofStatementInspector, aClassrepresenting an class that implementsStatementInspector, or the name of a class that implementsStatementInspector.static final StringDeprecated.The JPA-standard settingJAKARTA_JDBC_URLis now preferred.static final StringSpecifies that generated primary keys may be retrieved using the JDBC 3Statement.getGeneratedKeys()operation.static final StringDeprecated, for removal: This API element is subject to removal in a future version.It's not necessary to set this explicitlystatic final StringSpecifies that comments should be added to the generated SQL.static final StringDeprecated.The JPA-standard settingJAKARTA_JDBC_USERis now preferred.Fields inherited from interface org.hibernate.cfg.AgroalSettings
AGROAL_ACQUISITION_TIMEOUT, AGROAL_CONFIG_PREFIX, AGROAL_FLUSH_ON_CLOSE, AGROAL_IDLE_TIMEOUT, AGROAL_IDLE_VALIDATION_TIMEOUT, AGROAL_INITIAL_SIZE, AGROAL_INITIAL_SQL, AGROAL_LEAK_TIMEOUT, AGROAL_MAX_LIFETIME, AGROAL_MAX_SIZE, AGROAL_MIN_SIZE, AGROAL_VALIDATE_ON_BORROW, AGROAL_VALIDATION_TIMEOUTFields inherited from interface org.hibernate.cfg.C3p0Settings
C3P0_ACQUIRE_INCREMENT, C3P0_CONFIG_PREFIX, C3P0_IDLE_TEST_PERIOD, C3P0_MAX_SIZE, C3P0_MAX_STATEMENTS, C3P0_MIN_SIZE, C3P0_TIMEOUTFields inherited from interface org.hibernate.cfg.HikariCPSettings
HIKARI_ACQUISITION_TIMEOUT, HIKARI_CONFIG_PREFIX, HIKARI_IDLE_TIMEOUT, HIKARI_INITIAL_SQL, HIKARI_INITIALIZATION_TIMEOUT, HIKARI_ISOLATE_INTERNAL_QUERIES, HIKARI_KEEPALIVE_TIME, HIKARI_LEAK_TIMEOUT, HIKARI_MAX_LIFETIME, HIKARI_MAX_SIZE, HIKARI_MIN_IDLE_SIZE, HIKARI_POOL_NAME, HIKARI_READ_ONLY, HIKARI_VALIDATION_TIMEOUT
-
Field Details
-
JAKARTA_JTA_DATASOURCE
Specifies a JTADataSourceto use for Connections. Hibernate allows either-
an instance of
DataSource -
a JNDI name under which to obtain the
DataSource; see alsoEnvironmentSettings.JNDI_URL,EnvironmentSettings.JNDI_CLASS,EnvironmentSettings.JNDI_PREFIX
See JPA 2 sections 9.4.3 and 8.2.1.5
- See Also:
-
an instance of
-
JAKARTA_NON_JTA_DATASOURCE
Specifies a non-JTADataSourceto use for Connections. Hibernate allows either-
an instance of
DataSource -
a JNDI name under which to obtain the
DataSource; see alsoEnvironmentSettings.JNDI_URL,EnvironmentSettings.JNDI_CLASS,EnvironmentSettings.JNDI_PREFIX
See JPA 2 sections 9.4.3 and 8.2.1.5
- See Also:
-
an instance of
-
JAKARTA_JDBC_DRIVER
Specifies the name of a JDBC driver to use to connect to the database.Used in conjunction with
JAKARTA_JDBC_URL,JAKARTA_JDBC_USERandJAKARTA_JDBC_PASSWORDto specify how to connect to the database.When connections are obtained from a
DataSource, use eitherJAKARTA_JTA_DATASOURCEorJAKARTA_NON_JTA_DATASOURCEinstead.See section 8.2.1.9
- See Also:
-
JAKARTA_JDBC_URL
Specifies the JDBC connection URL to use to connect to the database.Used in conjunction with
JAKARTA_JDBC_DRIVER,JAKARTA_JDBC_USERandJAKARTA_JDBC_PASSWORDto specify how to connect to the database.When connections are obtained from a
DataSource, use eitherJAKARTA_JTA_DATASOURCEorJAKARTA_NON_JTA_DATASOURCEinstead.See section 8.2.1.9
- See Also:
-
JAKARTA_JDBC_USER
Specifies the database user to use when connecting via JDBC.Used in conjunction with
JAKARTA_JDBC_DRIVER,JAKARTA_JDBC_URLandJAKARTA_JDBC_PASSWORDto specify how to connect to the database.Depending on the configured
ConnectionProvider, the specified username might be used to:-
create a JDBC connection using
DriverManager.getConnection(String,java.util.Properties)orDriver.connect(String,java.util.Properties), or -
obtain a JDBC connection from a datasource, using
DataSource.getConnection(String, String).
See section 8.2.1.9
- See Also:
-
create a JDBC connection using
-
JAKARTA_JDBC_PASSWORD
Specifies the password to use when connecting via JDBC.Used in conjunction with
JAKARTA_JDBC_DRIVER,JAKARTA_JDBC_URLandJAKARTA_JDBC_USERto specify how to connect to the database.See JPA 2 section 8.2.1.9
- See Also:
-
JAKARTA_HBM2DDL_CONNECTION
Allows passing a specificConnectioninstance to be used bySchemaManagementToolfor the purpose of determining theDialect, and for performingdatabase actionsif requested.For
Dialectresolution, "jakarta.persistence.database-product-name" and, optionally, "jakarta.persistence.database-product-version", "jakarta.persistence.database-major-version", and "jakarta.persistence.database-minor-version" can be used instead- See Also:
-
JAKARTA_HBM2DDL_DB_NAME
Specifies the name of the database vendor (as would be reported byDatabaseMetaData.getDatabaseProductName()) for the purpose of determining theDialectto use.For cases when the name of the database vendor is not enough alone, a combination of "jakarta.persistence.database-product-version", "jakarta.persistence.database-major-version" "jakarta.persistence.database-minor-version" can be used instead
- See Also:
- Implementation Specification:
database actionsare not available when supplying just the name and versions
-
JAKARTA_HBM2DDL_DB_VERSION
Used in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseProductVersion()) for the underlying database.- See Also:
-
JAKARTA_HBM2DDL_DB_MAJOR_VERSION
Used in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseMajorVersion()) for the underlying database.- See Also:
-
JAKARTA_HBM2DDL_DB_MINOR_VERSION
Used in conjunction with "jakarta.persistence.database-product-name" for the purpose of determining theDialectto use when the name does not provide enough detail.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseMinorVersion()) for the underlying database.- See Also:
-
DIALECT
Specifies the Hibernate SQL dialect, either- an instance of
Dialect, - a
Classrepresenting a class that extendsDialect, or - the name of a class that extends
Dialect.
By default, Hibernate will attempt to automatically determine the dialect from the JDBC URL and JDBC metadata, so this setting is not usually necessary.
- See Also:
- API Note:
- As of Hibernate 6, this property should not be explicitly specified,
except when using a custom user-written implementation of
Dialect. Instead, applications should allow Hibernate to select theDialectautomatically.
- an instance of
-
DIALECT_RESOLVERS
Specifies additionalDialectResolverimplementations to register with the standardDialectFactory.- See Also:
-
CONNECTION_PROVIDER
Specifies aConnectionProviderto use for obtaining JDBC connections, either:- a short strategy name like
agroal,hikaricp,c3p0, - an instance of
ConnectionProvider, - a
Classobject representing a class that implementsConnectionProvider, or - the name of a class that implements
ConnectionProvider.
If this property is not explicitly set, a connection provider is chosen automatically:
- if
JAKARTA_JTA_DATASOURCEorJAKARTA_NON_JTA_DATASOURCEis set, a datasource-based implementation is used; - otherwise, a
ConnectionProvideris loaded automatically as a Java service; - but if no service is found, or if more than one service is available, a default implementation is used as a fallback.
The default implementation is not recommended for use in production.
- See Also:
- API Note:
- The term
"class"appears in the setting name due to legacy reasons; however it can accept instances.
- a short strategy name like
-
POOL_SIZE
Specifies the maximum number of inactive connections for any connection pool which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.The default pool size depends on the connection provider.
- See Also:
-
ISOLATION
Specifies the JDBC transaction isolation level for connections obtained from anyConnectionProviderimplementation which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.Possible values are enumerated by
Connection:READ_UNCOMMITTED,READ_COMMITTED,REPEATABLE_READ,SERIALIZABLE.If this setting is not explicitly specified, Hibernate does not modify the transaction isolation level of the JDBC connection.
- See Also:
-
AUTOCOMMIT
Controls the autocommit mode of JDBC connections obtained from anyConnectionProviderimplementation which respects this setting, including every built-in implementation except forDatasourceConnectionProviderImpl.- See Also:
- Default Value:
false
-
CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT
Indicates that connections obtained from the configuredConnectionProviderhave auto-commit already disabled when they are acquired.It is inappropriate to set this value to
truewhen the connections returned by the provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernate executing SQL operations outside the scope of any transaction.- Since:
- 5.2.10
- See Also:
- API Note:
- By default, Hibernate calls
Connection.setAutoCommit(boolean)on newly-obtained connections. With this setting enabled, that call is skipped, along with some other operations, in the interest of performance. - Default Value:
false
-
CONNECTION_PREFIX
Deprecated.This setting is only supported byC3P0ConnectionProviderandDriverManagerConnectionProviderImpl.A prefix for properties specifying arbitrary JDBC connection properties. These properties are simply passed along to the provider when creating a connection.For example, declaring
hibernate.connection.foo=bartells Hibernate to appendfoo=barto the JDBC connection URL.- See Also:
-
STATEMENT_INSPECTOR
Specifies aStatementInspectorimplementation associated with theSessionFactory, either:- an instance of
StatementInspector, - a
Classrepresenting an class that implementsStatementInspector, or - the name of a class that implements
StatementInspector.
- Since:
- 5.0
- See Also:
- an instance of
-
SHOW_SQL
Enables logging of generated SQL to the console.- See Also:
- Default Value:
false
-
FORMAT_SQL
Enables formatting of SQL logged to the console.- See Also:
- Default Value:
false
-
HIGHLIGHT_SQL
Enables highlighting of SQL logged to the console using ANSI escape codes.- See Also:
- Default Value:
false
-
LOG_SLOW_QUERY
Specifies a duration in milliseconds defining the minimum query execution time that characterizes a "slow" query. Any SQL query which takes longer than this amount of time to execute will be logged.A value of
0, the default, disables logging of "slow" queries.- See Also:
-
USE_SQL_COMMENTS
Specifies that comments should be added to the generated SQL.- See Also:
- Default Value:
false
-
STATEMENT_FETCH_SIZE
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. If0, the JDBC driver's default settings will be used.- See Also:
- Default Value:
0
-
USE_SCROLLABLE_RESULTSET
Deprecated, for removal: This API element is subject to removal in a future version.It's not necessary to set this explicitlyControls how Hibernate should handle scrollable results:trueindicates that insensitive scrolling can be used;falseindicates that forward-only scrolling must be used.
- See Also:
- Default Value:
trueif the underlying driver supports scrollable results,falseotherwise
-
DIALECT_NATIVE_PARAM_MARKERS
Controls whether to use JDBC markers (`?`) or dialect native markers for parameters within preparable SQL statements.- Since:
- 6.2
- See Also:
- Implementation Note:
Falseby default, indicating standard JDBC parameter markers (`?`) are used. Set totrueto use the Dialect's native markers, if any. For Dialects without native markers, the standard JDBC strategy is used.
-
NON_CONTEXTUAL_LOB_CREATION
When enabled, specifies that Hibernate should not use contextual LOB creation.- See Also:
-
LOG_JDBC_WARNINGS
When enabled, specifies that JDBC statement warnings should be logged.Logging of JDBC warnings may also be controlled via the log category "org.hibernate.orm.jdbc.warn".
The default is determined by
Dialect.isJdbcLogWarningsEnabledByDefault().- Since:
- 5.1
- See Also:
-
LOG_JDBC_ERRORS
When enabled, specifies that JDBC errors should be logged before being rethrown.Logging of JDBC errors may also be controlled via the log category "org.hibernate.orm.jdbc.error".
- Since:
- 7
- See Also:
- Default Value:
true
-
JDBC_TIME_ZONE
Specifies the time zone to use in the JDBC driver, which is supposed to match the database timezone.This is the timezone what will be passed to
PreparedStatement.setTimestamp(int, java.sql.Timestamp, java.util.Calendar)PreparedStatement.setTime(int, java.sql.Time, java.util.Calendar),ResultSet.getTimestamp(int, Calendar), andResultSet.getTime(int, Calendar)when binding parameters.The time zone may be given as:
- an instance of
TimeZone, - an instance of
ZoneId, or - a time zone ID string to be passed to
ZoneId.of(String).
By default, the JVM default time zone is assumed by the JDBC driver.
- Since:
- 5.2.3
- See Also:
- an instance of
-
USE_GET_GENERATED_KEYS
Specifies that generated primary keys may be retrieved using the JDBC 3Statement.getGeneratedKeys()operation.Usually, performance will be improved if this behavior is enabled, assuming the JDBC driver supports
getGeneratedKeys().- See Also:
- Default Value:
trueif the underlying driver supportsgetGeneratedKeys(),falseotherwise
-
CONNECTION_HANDLING
Specifies how Hibernate should manage JDBC connections in terms of acquisition and release, either:- an instance of the enumeration
PhysicalConnectionHandlingMode, or - the name of one of its instances.
The default is
DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION.- Since:
- 5.2
- See Also:
- an instance of the enumeration
-
ALLOW_METADATA_ON_BOOT
Whether access to JDBC metadata is allowed during bootstrap. Typically, Hibernate accesses this metadata to understand the capabilities of the underlying database to help minimize needed configuration. Disabling this access means that only explicit settings are used. At a minimum, the Dialect to use must be specified using either the "hibernate.dialect" or "jakarta.persistence.database-product-name" setting. When the Dialect to use is specified in this manner it is generally a good idea to specify the database version as well - Dialects use the version to configure themselves.- Since:
- 6.5
- See Also:
- API Note:
- The specified Dialect may also provide defaults into the "explicit" settings.
- Default Value:
true
-
DRIVER
Deprecated.The JPA-standard settingJAKARTA_JDBC_DRIVERis now preferred.- See Also:
-
URL
Deprecated.The JPA-standard settingJAKARTA_JDBC_URLis now preferred.- See Also:
-
USER
Deprecated.The JPA-standard settingJAKARTA_JDBC_USERis now preferred.- See Also:
-
PASS
Deprecated.The JPA-standard settingJAKARTA_JDBC_PASSWORDis now preferred.- See Also:
-
DATASOURCE
Deprecated.The JPA-standard "jakarta.persistence.jtaDataSource" or "jakarta.persistence.nonJtaDataSource" setting are now preferred.- See Also:
-
JPA_JTA_DATASOURCE
Deprecated.UseJAKARTA_JTA_DATASOURCEinstead- See Also:
-
JPA_NON_JTA_DATASOURCE
Deprecated.UseJAKARTA_NON_JTA_DATASOURCEinstead- See Also:
-
JPA_JDBC_DRIVER
Deprecated.UseJAKARTA_JDBC_DRIVERinstead- See Also:
-
JPA_JDBC_URL
Deprecated.UseJAKARTA_JDBC_URLinstead- See Also:
-
JPA_JDBC_USER
Deprecated.UseJAKARTA_JDBC_USERinstead- See Also:
-
JPA_JDBC_PASSWORD
Deprecated.UseJAKARTA_JDBC_PASSWORDinstead- See Also:
-
HBM2DDL_CONNECTION
Deprecated.UseJAKARTA_HBM2DDL_CONNECTIONinstead- See Also:
-
DIALECT_DB_NAME
Deprecated.UseJAKARTA_HBM2DDL_DB_NAMEinstead- See Also:
-
DIALECT_DB_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_VERSIONinstead- See Also:
-
DIALECT_DB_MAJOR_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_MAJOR_VERSIONinstead- See Also:
-
DIALECT_DB_MINOR_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_MINOR_VERSIONinstead- See Also:
-
C3P0ConnectionProviderandDriverManagerConnectionProviderImpl.