Interface JdbcSettings
- All Superinterfaces:
AgroalSettings,C3p0Settings,HikariCPSettings
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
Field Summary
FieldsModifier and TypeFieldDescriptionstatic finalStringWhether access to JDBCmetadata is allowed during bootstrap.static finalStringControls the autocommit mode of JDBC connections obtained from anyConnectionProviderimplementation which respects this setting,including every built-in implementation except forDataSourceConnectionProvider.static finalStringSpecifies how Hibernate should manage JDBC connections in terms of acquisitionand release, either: an instance of the enumerationPhysicalConnectionHandlingMode, or the name of one of its instances.static finalStringDeprecated.This setting is only supported byC3P0ConnectionProviderandDriverManagerConnectionProvider.static finalStringSpecifies 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 finalStringIndicates that connections obtained from the configuredConnectionProviderhaveauto-commit already disabled when theyare acquired.static finalStringDeprecated.The JPA-standard"jakarta.persistence.jtaDataSource" or"jakarta.persistence.nonJtaDataSource" setting are now preferred.static finalStringSpecifies the HibernateSQL dialect, either an instance ofDialect, aClassrepresenting a class that extendsDialect, or the name of a class that extendsDialect.static finalStringDeprecated.UseJAKARTA_HBM2DDL_DB_MAJOR_VERSIONinsteadstatic finalStringDeprecated.UseJAKARTA_HBM2DDL_DB_MINOR_VERSIONinsteadstatic finalStringDeprecated.UseJAKARTA_HBM2DDL_DB_NAMEinsteadstatic finalStringDeprecated.UseJAKARTA_HBM2DDL_DB_VERSIONinsteadstatic finalStringControls whether to use JDBC markers (`?`) or dialect native markers for parameterswithinpreparable SQL statements.static finalStringSpecifies additionalDialectResolverimplementations to register with the standardDialectFactory.static finalStringDeprecated.The JPA-standard settingJAKARTA_JDBC_DRIVERis now preferred.static finalStringEnables formatting of SQL logged to the console.static finalStringDeprecated.UseJAKARTA_HBM2DDL_CONNECTIONinsteadstatic finalStringEnables highlighting of SQL logged to the console using ANSI escape codes.static finalStringSpecifies the JDBC transaction isolation level for connections obtainedfrom anyConnectionProviderimplementation which respects thissetting, including every built-in implementation except forDataSourceConnectionProvider.static finalStringAllows passing a specificConnectioninstance to be used bySchemaManagementToolfor the purpose ofdetermining theDialect, and for performingdatabase actionsif requested.static finalStringUsed in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.static finalStringUsed in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.static finalStringSpecifies the name of the database vendor (as would be reported byDatabaseMetaData.getDatabaseProductName()) for the purpose ofdetermining theDialectto use.static finalStringUsed in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.static finalStringSpecifies the name of a JDBC driver to use to connect to the database.static finalStringSpecifies the password to use when connecting via JDBC.static finalStringSpecifies the JDBC connection URL to use to connect to the database.static finalStringSpecifies the database user to use when connecting via JDBC.static finalStringSpecifies a JTADataSourceto use for Connections.static finalStringSpecifies a non-JTADataSourceto use for Connections.static finalStringSpecifies thetime zone to use in the JDBC driver,which is supposed to match the database timezone.static finalStringDeprecated.UseJAKARTA_JDBC_DRIVERinsteadstatic finalStringDeprecated.UseJAKARTA_JDBC_PASSWORDinsteadstatic finalStringDeprecated.UseJAKARTA_JDBC_URLinsteadstatic finalStringDeprecated.UseJAKARTA_JDBC_USERinsteadstatic finalStringDeprecated.UseJAKARTA_JTA_DATASOURCEinsteadstatic finalStringDeprecated.UseJAKARTA_NON_JTA_DATASOURCEinsteadstatic finalStringWhen enabled, specifies that JDBC errors should be logged before being rethrown.static finalStringWhen enabled, specifies that JDBC statement warnings should be logged.static finalStringSpecifies a duration in milliseconds defining the minimum query execution time thatcharacterizes a "slow" query.static finalStringWhen enabled, specifies that Hibernate should not use contextual LOB creation.static finalStringDeprecated.The JPA-standard settingJAKARTA_JDBC_PASSWORDis now preferred.static finalStringSpecifies the maximum number of inactive connections for anyconnection pool which respects thissetting, including every built-in implementation except forDataSourceConnectionProvider.static finalStringEnables logging of generated SQL to the console.static finalStringGives the JDBC driver a hint as to the number of rows that should be fetchedfrom the database when more rows are needed.static finalStringSpecifies aStatementInspectorimplementation associated with theSessionFactory,either: an instance ofStatementInspector, aClassrepresenting a class that implementsStatementInspector, or the name of a class that implementsStatementInspector.static finalStringDeprecated.The JPA-standard settingJAKARTA_JDBC_URLis now preferred.static finalStringSpecifies that generated primary keys may be retrieved using the JDBC 3Statement.getGeneratedKeys()operation.static finalStringDeprecated, for removal: This API element is subject to removal in a future version.It's not necessary to set this explicitlystatic finalStringSpecifies that comments should be added to the generated SQL.static finalStringDeprecated.The JPA-standard settingJAKARTA_JDBC_USERis now preferred.Fields inherited from interface 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 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 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, useeitherJAKARTA_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, useeitherJAKARTA_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
- 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
JAKARTA_HBM2DDL_CONNECTION
Allows passing a specificConnectioninstance to be used bySchemaManagementToolfor the purpose ofdetermining 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 insteadJAKARTA_HBM2DDL_DB_NAME
Specifies the name of the database vendor (as would be reported byDatabaseMetaData.getDatabaseProductName()) for the purpose ofdetermining theDialectto use.For cases when the name of the database vendor is not enough alone, a combinationof"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 notavailable when supplying just the name and versions
JAKARTA_HBM2DDL_DB_VERSION
Used in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseProductVersion()) for theunderlying database.JAKARTA_HBM2DDL_DB_MAJOR_VERSION
Used in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseMajorVersion()) for the underlyingdatabase.JAKARTA_HBM2DDL_DB_MINOR_VERSION
Used in conjunction with"jakarta.persistence.database-product-name" for the purpose ofdetermining theDialectto use when the name doesnot provide enough information.The value is expected to match what would be returned from
DatabaseMetaData.getDatabaseMinorVersion()) for the underlyingdatabase.DIALECT
Specifies the HibernateSQL 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 theJDBC 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 chosenautomatically:
- if
JAKARTA_JTA_DATASOURCEorJAKARTA_NON_JTA_DATASOURCEis set, a datasource-based implementation is used; - otherwise, a
ConnectionProvideris loaded automatically as aJava 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 anyconnection pool which respects thissetting, including every built-in implementation except forDataSourceConnectionProvider.The default pool size depends on the connection provider.
- See Also:
ISOLATION
Specifies the JDBC transaction isolation level for connections obtainedfrom anyConnectionProviderimplementation which respects thissetting, including every built-in implementation except forDataSourceConnectionProvider.Possible values are enumerated by
Connection:READ_UNCOMMITTED,READ_COMMITTED,REPEATABLE_READ,SERIALIZABLE.If this setting is not explicitly specified, Hibernate does not modifythe transaction isolation level of the JDBC connection.
AUTOCOMMIT
Controls the autocommit mode of JDBC connections obtained from anyConnectionProviderimplementation which respects this setting,including every built-in implementation except forDataSourceConnectionProvider.- See Also:
- Default Value:
false
CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT
Indicates that connections obtained from the configuredConnectionProviderhaveauto-commit already disabled when theyare acquired.It is inappropriate to set this value to
truewhen the connections returned bythe provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernateexecuting 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, alongwith some other operations, in the interest of performance. - Default Value:
false
CONNECTION_PREFIX
Deprecated.This setting is only supported byC3P0ConnectionProviderandDriverManagerConnectionProvider.A prefix for properties specifying arbitrary JDBC connection properties. Theseproperties are simply passed along to the provider when creating a connection.For example, declaring
hibernate.connection.foo=bartells Hibernate toappendfoo=barto the JDBC connection URL.- See Also:
STATEMENT_INSPECTOR
Specifies aStatementInspectorimplementation associated with theSessionFactory,either:- an instance of
StatementInspector, - a
Classrepresenting a class that implementsStatementInspector, or - the name of a class that implements
StatementInspector.
- 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 thatcharacterizes a "slow" query. Any SQL query which takes longer than this amount oftime to execute will be logged.A value of
0, the default, disables logging of "slow" queries.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 fetchedfrom the database when more rows are needed. If0, the JDBC driver'sdefault settings will be used.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 thatinsensitive scrolling can be used;falseindicates thatforward-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 parameterswithinpreparable 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. ForDialects without native markers, the standard JDBC strategy is used.
NON_CONTEXTUAL_LOB_CREATION
When enabled, specifies that Hibernate should not use contextual LOB creation.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 thetime 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, theJVM default time zoneis 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, assumingthe 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 acquisitionand 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.- an instance of the enumeration
ALLOW_METADATA_ON_BOOT
Whether access to JDBCmetadata is allowed during bootstrap.Allowable options are defined byJdbcMetadataOnBoot. For configuration, any of thefollowing forms are accepted:- an instance ofJdbcMetadataOnBoot
- case-insensitiveJdbcMetadataOnBoot option name
- for legacy purposes,
trueorfalse-trueis mapped toJdbcMetadataOnBoot.ALLOW andfalseis mapped toJdbcMetadataOnBoot.DISALLOW
- Since:
- 6.5
- See Also:
- Default Value:
allow
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_NAMEinsteadDIALECT_DB_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_VERSIONinstead- See Also:
DIALECT_DB_MAJOR_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_MAJOR_VERSIONinsteadDIALECT_DB_MINOR_VERSION
Deprecated.UseJAKARTA_HBM2DDL_DB_MINOR_VERSIONinstead