Class JdbcEnvironmentImpl
- java.lang.Object
-
- org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl
-
- All Implemented Interfaces:
Serializable,JdbcEnvironment,Service
public class JdbcEnvironmentImpl extends Object implements JdbcEnvironment
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCHEMA_NAME_RESOLVER
-
Constructor Summary
Constructors Constructor Description JdbcEnvironmentImpl(DatabaseMetaData databaseMetaData, Dialect dialect, JdbcConnectionAccess jdbcConnectionAccess)Constructor form used from testingJdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect)Constructor form used when the JDBCDatabaseMetaDatais not available.JdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect, DatabaseMetaData databaseMetaData)Deprecated.currently used by Hibernate Reactive This version of the constructor should handle the case in which we do actually have the option to access the DatabaseMetaData, but since Hibernate Reactive is currently not making use of it we take a shortcut.JdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect, DatabaseMetaData databaseMetaData, JdbcConnectionAccess jdbcConnectionAccess)The main constructor form.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentifiergetCurrentCatalog()Get the current database catalog.IdentifiergetCurrentSchema()Get the current database catalog.DialectgetDialect()Get the dialect for this environment.ExtractedDatabaseMetaDatagetExtractedDatabaseMetaData()Access to the bits of information we pulled off the JDBCDatabaseMetaData(that did not get "interpreted" into the helpers/delegates available here).IdentifierHelpergetIdentifierHelper()Obtain the helper for dealing with identifiers in this environment.LobCreatorBuildergetLobCreatorBuilder()Retrieve the delegate for buildingLobCreatorinstances.NameQualifierSupportgetNameQualifierSupport()Obtain the level of support for qualified names.QualifiedObjectNameFormattergetQualifiedObjectNameFormatter()Obtain support for formatting qualified object names.SqlAstTranslatorFactorygetSqlAstTranslatorFactory()SqlExceptionHelpergetSqlExceptionHelper()Obtain the helper for dealing with JDBCSQLExceptionfaults.static booleanisMultiTenancyEnabled(ServiceRegistry serviceRegistry)
-
-
-
Field Detail
-
SCHEMA_NAME_RESOLVER
public static final String SCHEMA_NAME_RESOLVER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JdbcEnvironmentImpl
public JdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect)
Constructor form used when the JDBCDatabaseMetaDatais not available.- Parameters:
serviceRegistry- The service registrydialect- The resolved dialect.
-
JdbcEnvironmentImpl
public JdbcEnvironmentImpl(DatabaseMetaData databaseMetaData, Dialect dialect, JdbcConnectionAccess jdbcConnectionAccess) throws SQLException
Constructor form used from testing- Throws:
SQLException
-
JdbcEnvironmentImpl
@Deprecated public JdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect, DatabaseMetaData databaseMetaData) throws SQLException
Deprecated.currently used by Hibernate Reactive This version of the constructor should handle the case in which we do actually have the option to access the DatabaseMetaData, but since Hibernate Reactive is currently not making use of it we take a shortcut.- Throws:
SQLException
-
JdbcEnvironmentImpl
public JdbcEnvironmentImpl(ServiceRegistryImplementor serviceRegistry, Dialect dialect, DatabaseMetaData databaseMetaData, JdbcConnectionAccess jdbcConnectionAccess) throws SQLException
The main constructor form. Builds a JdbcEnvironment using the available DatabaseMetaData- Parameters:
serviceRegistry- The service registrydialect- The resolved dialectdatabaseMetaData- The available DatabaseMetaData- Throws:
SQLException
-
-
Method Detail
-
isMultiTenancyEnabled
public static boolean isMultiTenancyEnabled(ServiceRegistry serviceRegistry)
-
getDialect
public Dialect getDialect()
Description copied from interface:JdbcEnvironmentGet the dialect for this environment.- Specified by:
getDialectin interfaceJdbcEnvironment- Returns:
- The dialect.
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
- Specified by:
getSqlAstTranslatorFactoryin interfaceJdbcEnvironment
-
getExtractedDatabaseMetaData
public ExtractedDatabaseMetaData getExtractedDatabaseMetaData()
Description copied from interface:JdbcEnvironmentAccess to the bits of information we pulled off the JDBCDatabaseMetaData(that did not get "interpreted" into the helpers/delegates available here).- Specified by:
getExtractedDatabaseMetaDatain interfaceJdbcEnvironment- Returns:
- The values extracted from JDBC DatabaseMetaData
-
getCurrentCatalog
public Identifier getCurrentCatalog()
Description copied from interface:JdbcEnvironmentGet the current database catalog. Typically will come from eitherConnection.getCatalog()or "hibernate.default_catalog".- Specified by:
getCurrentCatalogin interfaceJdbcEnvironment- Returns:
- The current catalog.
-
getCurrentSchema
public Identifier getCurrentSchema()
Description copied from interface:JdbcEnvironmentGet the current database catalog. Typically will come from eitherSchemaNameResolver.resolveSchemaName(java.sql.Connection, Dialect)or "hibernate.default_catalog".- Specified by:
getCurrentSchemain interfaceJdbcEnvironment- Returns:
- The current schema
-
getQualifiedObjectNameFormatter
public QualifiedObjectNameFormatter getQualifiedObjectNameFormatter()
Description copied from interface:JdbcEnvironmentObtain support for formatting qualified object names.- Specified by:
getQualifiedObjectNameFormatterin interfaceJdbcEnvironment- Returns:
- Qualified name support.
-
getIdentifierHelper
public IdentifierHelper getIdentifierHelper()
Description copied from interface:JdbcEnvironmentObtain the helper for dealing with identifiers in this environment.Note that the Identifiers returned from this IdentifierHelper already account for auto-quoting :) yaay!
- Specified by:
getIdentifierHelperin interfaceJdbcEnvironment- Returns:
- The identifier helper.
-
getNameQualifierSupport
public NameQualifierSupport getNameQualifierSupport()
Description copied from interface:JdbcEnvironmentObtain the level of support for qualified names.- Specified by:
getNameQualifierSupportin interfaceJdbcEnvironment- Returns:
- The NameQualifierSupport.
-
getSqlExceptionHelper
public SqlExceptionHelper getSqlExceptionHelper()
Description copied from interface:JdbcEnvironmentObtain the helper for dealing with JDBCSQLExceptionfaults.- Specified by:
getSqlExceptionHelperin interfaceJdbcEnvironment- Returns:
- This environment's helper.
-
getLobCreatorBuilder
public LobCreatorBuilder getLobCreatorBuilder()
Description copied from interface:JdbcEnvironmentRetrieve the delegate for buildingLobCreatorinstances.- Specified by:
getLobCreatorBuilderin interfaceJdbcEnvironment- Returns:
- The LobCreator builder.
-
-