Top Description Fields
org.hibernate.cfg

public Interface JdbcSettings

extends C3p0Settings, ProxoolSettings
Known Direct Subinterfaces
org.hibernate.cfg.AvailableSettings
Imports
java.util.Calendar, org.hibernate.Incubating, org.hibernate.context.spi.CurrentTenantIdentifierResolver, org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData, org.hibernate.query.Query, org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode, .StatementInspector, org.hibernate.sql.ast.spi.ParameterMarkerStrategy

Settings related to JDBC, Connections, pools, Dialects, etc
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
AUTOCOMMIT

Controls the autocommit mode of JDBC connections obtained from any ConnectionProvider implementation which respects this setting, which the built-in implementations do, except for org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.

public static final String
CONNECTION_HANDLING

Specifies how Hibernate should manage JDBC connections in terms of acquisition and release, either:

public static final String
CONNECTION_PREFIX

A prefix for properties specifying arbitrary JDBC connection properties.

public static final String
CONNECTION_PROVIDER

Specifies a ConnectionProvider to use for obtaining JDBC connections, either:

  • an instance of ConnectionProvider,
  • a Class representing a class that implements ConnectionProvider, or
  • the name of a class that implements ConnectionProvider.
public static final String
CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT

Indicates that Connections obtained from the configured ConnectionProvider have auto-commit already disabled when they are acquired.

public static final String
DATASOURCE

Deprecated The JPA-standard JAKARTA_JTA_DATASOURCE or JAKARTA_JTA_DATASOURCE setting is now preferred.
public static final String
DIALECT

Specifies the Hibernate SQL dialect, either

public static final String
public static final String
public static final String
public static final String
public static final String
DIALECT_NATIVE_PARAM_MARKERS

Controls whether to use JDBC markers (`?`) or dialect native markers for parameters within preparable SQL statements.

public static final String
public static final String
DRIVER

Deprecated The JPA-standard setting JAKARTA_JDBC_DRIVER is now preferred.
public static final String
FORMAT_SQL

Enables formatting of SQL logged to the console.

public static final String
public static final String
HIGHLIGHT_SQL

Enables highlighting of SQL logged to the console using ANSI escape codes.

public static final String
ISOLATION

Specified the JDBC transaction isolation level.

public static final String
JAKARTA_HBM2DDL_CONNECTION

Allows passing a specific java.sql.Connection instance to be used by org.hibernate.tool.schema.spi.SchemaManagementTool for the purpose of determining the org.hibernate.dialect.Dialect, and for performing database actions if requested.

public static final String
JAKARTA_HBM2DDL_DB_MAJOR_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

public static final String
JAKARTA_HBM2DDL_DB_MINOR_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

public static final String
JAKARTA_HBM2DDL_DB_NAME

Specifies the name of the database vendor (as would be reported by java.sql.DatabaseMetaData#getDatabaseProductName) for the purpose of determining the org.hibernate.dialect.Dialect to use.

public static final String
JAKARTA_HBM2DDL_DB_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

public static final String
JAKARTA_JDBC_DRIVER

Specifies the name of a JDBC driver to use to connect to the database.

public static final String
JAKARTA_JDBC_PASSWORD

Specifies the password to use when connecting via JDBC.

public static final String
JAKARTA_JDBC_URL

Specifies the JDBC connection URL to use to connect to the database.

public static final String
JAKARTA_JDBC_USER

Specifies the database user to use when connecting via JDBC.

public static final String
JAKARTA_JTA_DATASOURCE

Specifies a JTA javax.sql.DataSource to use for Connections.

public static final String
JAKARTA_NON_JTA_DATASOURCE

Specifies a non-JTA javax.sql.DataSource to use for Connections.

public static final String
JDBC_TIME_ZONE

Specifies the time zone to use in the JDBC driver, which is supposed to match the database timezone.

public static final String
JPA_JDBC_DRIVER

Deprecated Use JAKARTA_JDBC_DRIVER instead
public static final String
public static final String
JPA_JDBC_URL

Deprecated Use JAKARTA_JDBC_URL instead
public static final String
JPA_JDBC_USER

Deprecated Use JAKARTA_JDBC_USER instead
public static final String
public static final String
public static final String
LOG_JDBC_WARNINGS

When enabled, specifies that JDBC statement warnings should be logged.

public static final String
LOG_SLOW_QUERY

Specifies a duration in milliseconds defining the minimum query execution time that characterizes a "slow" query.

public static final String
NON_CONTEXTUAL_LOB_CREATION

When enabled, specifies that Hibernate should not use contextual LOB creation.

public static final String
PASS

Deprecated The JPA-standard setting JAKARTA_JDBC_USER is now preferred.
public static final String
POOL_SIZE

Specifies the maximum number of inactive connections for the built-in connection pool.

public static final String
SHOW_SQL

Enables logging of generated SQL to the console.

public static final String
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.

public static final String
STATEMENT_INSPECTOR

Specifies a org.hibernate.resource.jdbc.spi.StatementInspector implementation associated with the org.hibernate.SessionFactory, either:

  • an instance of StatementInspector,
  • a Class representing an class that implements StatementInspector, or
  • the name of a class that implements StatementInspector.
public static final String
URL

Deprecated The JPA-standard setting JAKARTA_JDBC_URL is now preferred.
public static final String
USE_GET_GENERATED_KEYS

Specifies that generated primary keys may be retrieved using the JDBC 3 java.sql.PreparedStatement#getGeneratedKeys() operation.

public static final String
USE_SCROLLABLE_RESULTSET

Controls how Hibernate should handle scrollable results -

  • true indicates that insensitive scrolling can be used
  • false indicates that sensitive scrolling must be used
public static final String
USE_SQL_COMMENTS

Specifies that comments should be added to the generated SQL.

public static final String
USER

Deprecated The JPA-standard setting JAKARTA_JDBC_USER is now preferred.
Inherited from org.hibernate.cfg.C3p0Settings:
C3P0_ACQUIRE_INCREMENTC3P0_CONFIG_PREFIXC3P0_IDLE_TEST_PERIODC3P0_MAX_SIZEC3P0_MAX_STATEMENTSC3P0_MIN_SIZEC3P0_TIMEOUT
Inherited from org.hibernate.cfg.ProxoolSettings:
PROXOOL_CONFIG_PREFIXPROXOOL_EXISTING_POOLPROXOOL_POOL_ALIASPROXOOL_PROPERTIESPROXOOL_XML

Field Detail

AUTOCOMMITback to summary
public static final String AUTOCOMMIT

Controls the autocommit mode of JDBC connections obtained from any ConnectionProvider implementation which respects this setting, which the built-in implementations do, except for org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.

CONNECTION_HANDLINGback to summary
public static final String CONNECTION_HANDLING

Specifies how Hibernate should manage JDBC connections in terms of acquisition and release, either:

The default is DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION.

Since
5.2
See Also
org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode, org.hibernate.boot.SessionFactoryBuilder#applyConnectionHandlingMode(PhysicalConnectionHandlingMode)
CONNECTION_PREFIXback to summary
public static final String CONNECTION_PREFIX

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=bar tells Hibernate to append foo=bar to the JDBC connection URL.

CONNECTION_PROVIDERback to summary
public static final String CONNECTION_PROVIDER

Specifies a ConnectionProvider to use for obtaining JDBC connections, either:

  • an instance of ConnectionProvider,
  • a Class representing a class that implements ConnectionProvider, or
  • the name of a class that implements ConnectionProvider.

The term "class" appears in the setting name due to legacy reasons; however it can accept instances.

CONNECTION_PROVIDER_DISABLES_AUTOCOMMITback to summary
public static final String CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT

Indicates that Connections obtained from the configured ConnectionProvider have auto-commit already disabled when they are acquired.

It is inappropriate to set this value to true when 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.

API Note

By default, Hibernate calls java.sql.Connection#setAutoCommit(boolean) on newly-obtained connections. This setting allows to circumvent that call (as well as other operations) in the interest of performance.

Since
5.2.10
See Also
org.hibernate.boot.SessionFactoryBuilder#applyConnectionProviderDisablesAutoCommit(boolean)
DATASOURCEback to summary
public static final String DATASOURCE

Deprecated

The JPA-standard JAKARTA_JTA_DATASOURCE or JAKARTA_JTA_DATASOURCE setting is now preferred.

Annotations
@Deprecated
See Also
javax.sql.DataSource
DIALECTback to summary
public static final String DIALECT

Specifies the Hibernate SQL dialect, either

By default, Hibernate will attempt to automatically determine the dialect from the JDBC URL and JDBC metadata, so this setting is not usually necessary.

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 the Dialect automatically.

See Also
org.hibernate.dialect.Dialect
DIALECT_DB_MAJOR_VERSIONback to summary
public static final String DIALECT_DB_MAJOR_VERSION

Deprecated

Use JAKARTA_HBM2DDL_DB_MAJOR_VERSION instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
See Also
DIALECT_DB_NAME, DIALECT_DB_MINOR_VERSION
DIALECT_DB_MINOR_VERSIONback to summary
public static final String DIALECT_DB_MINOR_VERSION

Deprecated

Use JAKARTA_HBM2DDL_DB_MINOR_VERSION instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
See Also
DIALECT_DB_NAME, DIALECT_DB_MAJOR_VERSION, org.hibernate.engine.jdbc.dialect.spi.DialectResolver
DIALECT_DB_NAMEback to summary
public static final String DIALECT_DB_NAME

Deprecated

Use JAKARTA_HBM2DDL_DB_NAME instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
See Also
DIALECT_DB_VERSION, DIALECT_DB_MAJOR_VERSION, DIALECT_DB_MINOR_VERSION
DIALECT_DB_VERSIONback to summary
public static final String DIALECT_DB_VERSION

Deprecated

Use JAKARTA_HBM2DDL_DB_VERSION instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
See Also
DIALECT_DB_NAME
DIALECT_NATIVE_PARAM_MARKERSback to summary
public static final String DIALECT_NATIVE_PARAM_MARKERS

Controls whether to use JDBC markers (`?`) or dialect native markers for parameters within preparable SQL statements.

Implementation Note

False by default, indicating standard JDBC parameter markers (`?`) are used. Set to true to use the Dialect's native markers, if any. For Dialects without native markers, the standard JDBC strategy is used.

Annotations
@Incubating
Since
6.2
See Also
ParameterMarkerStrategy, org.hibernate.dialect.Dialect#getNativeParameterMarkerStrategy()
DIALECT_RESOLVERSback to summary
public static final String DIALECT_RESOLVERS

Specifies additional org.hibernate.engine.jdbc.dialect.spi.DialectResolver implementations to register with the standard org.hibernate.engine.jdbc.dialect.spi.DialectFactory.

DRIVERback to summary
public static final String DRIVER

Deprecated

The JPA-standard setting JAKARTA_JDBC_DRIVER is now preferred.

Annotations
@Deprecated
FORMAT_SQLback to summary
public static final String FORMAT_SQL

Enables formatting of SQL logged to the console.

HBM2DDL_CONNECTIONback to summary
public static final String HBM2DDL_CONNECTION

Deprecated

Use JAKARTA_HBM2DDL_CONNECTION instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
HIGHLIGHT_SQLback to summary
public static final String HIGHLIGHT_SQL

Enables highlighting of SQL logged to the console using ANSI escape codes.

ISOLATIONback to summary
public static final String ISOLATION

Specified the JDBC transaction isolation level.

JAKARTA_HBM2DDL_CONNECTIONback to summary
public static final String JAKARTA_HBM2DDL_CONNECTION

Allows passing a specific java.sql.Connection instance to be used by org.hibernate.tool.schema.spi.SchemaManagementTool for the purpose of determining the org.hibernate.dialect.Dialect, and for performing database actions if requested.

For Dialect resolution, 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, JAKARTA_HBM2DDL_DB_VERSION, JAKARTA_HBM2DDL_DB_MAJOR_VERSION, JAKARTA_HBM2DDL_DB_MINOR_VERSION
JAKARTA_HBM2DDL_DB_MAJOR_VERSIONback to summary
public static final String JAKARTA_HBM2DDL_DB_MAJOR_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

The value is expected to match what would be returned from java.sql.DatabaseMetaData#getDatabaseMajorVersion()) for the underlying database.

See Also
JAKARTA_HBM2DDL_DB_NAME
JAKARTA_HBM2DDL_DB_MINOR_VERSIONback to summary
public static final String JAKARTA_HBM2DDL_DB_MINOR_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

The value is expected to match what would be returned from java.sql.DatabaseMetaData#getDatabaseMinorVersion()) for the underlying database.

See Also
JAKARTA_HBM2DDL_DB_NAME
JAKARTA_HBM2DDL_DB_NAMEback to summary
public static final String JAKARTA_HBM2DDL_DB_NAME

Specifies the name of the database vendor (as would be reported by java.sql.DatabaseMetaData#getDatabaseProductName) for the purpose of determining the org.hibernate.dialect.Dialect to 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

Implementation Specification

database actions are not available when supplying just the name and versions

See Also
JAKARTA_HBM2DDL_DB_VERSION, JAKARTA_HBM2DDL_DB_MAJOR_VERSION, JAKARTA_HBM2DDL_DB_MINOR_VERSION
JAKARTA_HBM2DDL_DB_VERSIONback to summary
public static final String JAKARTA_HBM2DDL_DB_VERSION

Used in conjunction with jakarta.persistence.database-product-name for the purpose of determining the org.hibernate.dialect.Dialect to use when the name does not provide enough detail.

The value is expected to match what would be returned from java.sql.DatabaseMetaData#getDatabaseProductVersion()) for the underlying database.

See Also
JAKARTA_HBM2DDL_DB_NAME
JAKARTA_JDBC_DRIVERback to summary
public static final String 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_USER and JAKARTA_JDBC_PASSWORD to specify how to connect to the database.

When connections are obtained from a javax.sql.DataSource, use either JAKARTA_JTA_DATASOURCE or JAKARTA_NON_JTA_DATASOURCE instead.

See section 8.2.1.9

JAKARTA_JDBC_PASSWORDback to summary
public static final String JAKARTA_JDBC_PASSWORD

Specifies the password to use when connecting via JDBC.

Used in conjunction with JAKARTA_JDBC_DRIVER, JAKARTA_JDBC_URL and JAKARTA_JDBC_USER to specify how to connect to the database.

See JPA 2 section 8.2.1.9

JAKARTA_JDBC_URLback to summary
public static final String JAKARTA_JDBC_URL

Specifies the JDBC connection URL to use to connect to the database.

Used in conjunction with JAKARTA_JDBC_DRIVER, JAKARTA_JDBC_USER and JAKARTA_JDBC_PASSWORD to specify how to connect to the database.

When connections are obtained from a javax.sql.DataSource, use either JAKARTA_JTA_DATASOURCE or JAKARTA_NON_JTA_DATASOURCE instead.

See section 8.2.1.9

JAKARTA_JDBC_USERback to summary
public static final String JAKARTA_JDBC_USER

Specifies the database user to use when connecting via JDBC.

Used in conjunction with JAKARTA_JDBC_DRIVER, JAKARTA_JDBC_URL and JAKARTA_JDBC_PASSWORD to specify how to connect to the database.

Depending on the configured ConnectionProvider, the specified username might be used to:

See section 8.2.1.9

JAKARTA_JTA_DATASOURCEback to summary
public static final String JAKARTA_JTA_DATASOURCE

Specifies a JTA javax.sql.DataSource to use for Connections. Hibernate allows either

See JPA 2 sections 9.4.3 and 8.2.1.5

JAKARTA_NON_JTA_DATASOURCEback to summary
public static final String JAKARTA_NON_JTA_DATASOURCE

Specifies a non-JTA javax.sql.DataSource to use for Connections. Hibernate allows either

See JPA 2 sections 9.4.3 and 8.2.1.5

JDBC_TIME_ZONEback to summary
public static final String 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 java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar) java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar), java.sql.ResultSet#getTimestamp(int, Calendar), and java.sql.ResultSet#getTime(int, Calendar) when binding parameters.

The time zone may be given as:

By default, the JVM default time zone is assumed by the JDBC driver.

Since
5.2.3
JPA_JDBC_DRIVERback to summary
public static final String JPA_JDBC_DRIVER

Deprecated

Use JAKARTA_JDBC_DRIVER instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
JPA_JDBC_PASSWORDback to summary
public static final String JPA_JDBC_PASSWORD

Deprecated

Use JAKARTA_JDBC_PASSWORD instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
JPA_JDBC_URLback to summary
public static final String JPA_JDBC_URL

Deprecated

Use JAKARTA_JDBC_URL instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
JPA_JDBC_USERback to summary
public static final String JPA_JDBC_USER

Deprecated

Use JAKARTA_JDBC_USER instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
JPA_JTA_DATASOURCEback to summary
public static final String JPA_JTA_DATASOURCE

Deprecated

Use JAKARTA_JTA_DATASOURCE instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
JPA_NON_JTA_DATASOURCEback to summary
public static final String JPA_NON_JTA_DATASOURCE

Deprecated

Use JAKARTA_NON_JTA_DATASOURCE instead

Annotations
@Deprecated
@SuppressWarnings:DeprecatedIsStillUsed
LOG_JDBC_WARNINGSback to summary
public static final String LOG_JDBC_WARNINGS

When enabled, specifies that JDBC statement warnings should be logged.

The default is determined by org.hibernate.dialect.Dialect#isJdbcLogWarningsEnabledByDefault().

Since
5.1
See Also
java.sql.Statement#getWarnings()
LOG_SLOW_QUERYback to summary
public static final String 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
org.hibernate.stat.Statistics#getSlowQueries()
NON_CONTEXTUAL_LOB_CREATIONback to summary
public static final String NON_CONTEXTUAL_LOB_CREATION

When enabled, specifies that Hibernate should not use contextual LOB creation.

See Also
org.hibernate.engine.jdbc.LobCreator, org.hibernate.engine.jdbc.LobCreationContext
PASSback to summary
public static final String PASS

Deprecated

The JPA-standard setting JAKARTA_JDBC_USER is now preferred.

Annotations
@Deprecated
See Also
USER
POOL_SIZEback to summary
public static final String POOL_SIZE

Specifies the maximum number of inactive connections for the built-in connection pool.

SHOW_SQLback to summary
public static final String SHOW_SQL

Enables logging of generated SQL to the console.

STATEMENT_FETCH_SIZEback to summary
public static final String 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. If 0, the JDBC driver's default settings will be used.

See Also
java.sql.PreparedStatement#setFetchSize(int), org.hibernate.boot.SessionFactoryBuilder#applyJdbcFetchSize(int), org.hibernate.ScrollableResults#setFetchSize(int)
STATEMENT_INSPECTORback to summary
public static final String STATEMENT_INSPECTOR

Specifies a org.hibernate.resource.jdbc.spi.StatementInspector implementation associated with the org.hibernate.SessionFactory, either:

  • an instance of StatementInspector,
  • a Class representing an class that implements StatementInspector, or
  • the name of a class that implements StatementInspector.
Since
5.0
See Also
org.hibernate.boot.SessionFactoryBuilder#applyStatementInspector(StatementInspector)
URLback to summary
public static final String URL

Deprecated

The JPA-standard setting JAKARTA_JDBC_URL is now preferred.

Annotations
@Deprecated
USE_GET_GENERATED_KEYSback to summary
public static final String USE_GET_GENERATED_KEYS

Specifies that generated primary keys may be retrieved using the JDBC 3 java.sql.PreparedStatement#getGeneratedKeys() operation.

Usually, performance will be improved if this behavior is enabled, assuming the JDBC driver supports getGeneratedKeys().

See Also
java.sql.PreparedStatement#getGeneratedKeys, org.hibernate.boot.SessionFactoryBuilder#applyGetGeneratedKeysSupport(boolean)
USE_SCROLLABLE_RESULTSETback to summary
public static final String USE_SCROLLABLE_RESULTSET

Controls how Hibernate should handle scrollable results -

  • true indicates that insensitive scrolling can be used
  • false indicates that sensitive scrolling must be used
See Also
org.hibernate.boot.SessionFactoryBuilder#applyScrollableResultsSupport(boolean), Query#scroll, ExtractedDatabaseMetaData#supportsScrollableResults()
USE_SQL_COMMENTSback to summary
public static final String USE_SQL_COMMENTS

Specifies that comments should be added to the generated SQL.

See Also
org.hibernate.boot.SessionFactoryBuilder#applySqlComments(boolean)
USERback to summary
public static final String USER

Deprecated

The JPA-standard setting JAKARTA_JDBC_USER is now preferred.

Annotations
@Deprecated
See Also
PASS