Package liquibase.ext.hibernate.database
Class HibernateDatabase
java.lang.Object
liquibase.database.AbstractJdbcDatabase
liquibase.ext.hibernate.database.HibernateDatabase
- All Implemented Interfaces:
AutoCloseable,liquibase.database.Database,liquibase.servicelocator.PrioritizedService
- Direct Known Subclasses:
HibernateClassicDatabase,HibernateEjb3Database,HibernateSpringBeanDatabase
public abstract class HibernateDatabase
extends liquibase.database.AbstractJdbcDatabase
Base class for all Hibernate Databases. This extension interacts with Hibernate by creating standard liquibase.database.Database implementations that
bridge what Liquibase expects and the Hibernate APIs.
-
Field Summary
FieldsFields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercasedFields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerform any post-configuration setting logic.protected final org.hibernate.boot.MetadataCalled bysetConnection(DatabaseConnection)to create the Metadata stored in this database.protected org.hibernate.boot.MetadataCalled bybuildMetadata()when aCustomMetadataFactoryis not configured.protected voidconfigureImplicitNamingStrategy(String implicitNamingStrategy, org.hibernate.boot.MetadataBuilder builder) protected voidconfigureMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder) Called bybuildMetadataFromPath()to do final configuration on theMetadataBuilderbeforeMetadataBuilder.build()is called.protected voidconfigurePhysicalNamingStrategy(String physicalNamingStrategy, org.hibernate.boot.MetadataBuilder builder) protected abstract voidconfigureSources(org.hibernate.boot.MetadataSources sources) Adds any implementation-specific sources to the givenMetadataSourcesprotected org.hibernate.boot.MetadataSourcesCreates the baseMetadataSourcesto use for this database.booleanprotected StringCalled bycreateMetadataSources()to determine the correct dialect name based on url parameters, configuration files, etc.protected Stringprotected StringgetDefaultDriver(String url) org.hibernate.dialect.DialectReturns the dialect determined during database initialization.protected HibernateConnectionConvenience method to return the underlying HibernateConnection in the JdbcConnection returned byAbstractJdbcDatabase.getConnection()org.hibernate.boot.MetadataReturn the hibernateMetadataused by this database.intgetProperty(String name) Returns the value of the given property.booleanbooleanbooleanbooleanvoidsetConnection(liquibase.database.DatabaseConnection conn) booleanbooleanbooleanbooleanMethods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, correctObjectName, correctSchema, correctSchema, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeIndexName, escapeObjectName, escapeObjectName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateAutoIncrementBy, generateAutoIncrementStartWith, generateDatabaseFunctionValue, generatePrimaryKeyName, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionSchemaNameCallStatement, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductVersion, getDataTypeMaxParameters, getDateFunctions, getDateLiteral, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultDatabaseProductName, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getFetchSize, getJdbcCatalogName, getJdbcCatalogName, getJdbcSchemaName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getMaxFractionalDigitsForTimestamp, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSchemaAndCatalogCase, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isAutoCommit, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isReservedWord, isSystemObject, isSystemView, isTimeOnly, isTimestamp, jdbcCallsCatalogsSchemas, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsAutoIncrement, supportsBatchUpdates, supportsCatalogInObjectName, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsForeignKeyDisable, supportsNotNullConstraintNames, supportsPrimaryKeyNames, supportsRestrictForeignKeys, supportsSequences, tag, toString, unescapeDataTypeName, unescapeDataTypeString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface liquibase.database.Database
getDisplayName, getShortName, isCorrectDatabaseImplementation
-
Field Details
-
dialect
protected org.hibernate.dialect.Dialect dialect -
DEFAULT_SCHEMA
- See Also:
-
-
Constructor Details
-
HibernateDatabase
public HibernateDatabase()
-
-
Method Details
-
requiresPassword
public boolean requiresPassword()- Specified by:
requiresPasswordin interfaceliquibase.database.Database- Overrides:
requiresPasswordin classliquibase.database.AbstractJdbcDatabase
-
requiresUsername
public boolean requiresUsername()- Specified by:
requiresUsernamein interfaceliquibase.database.Database- Overrides:
requiresUsernamein classliquibase.database.AbstractJdbcDatabase
-
getDefaultDriver
-
getPriority
public int getPriority() -
setConnection
public void setConnection(liquibase.database.DatabaseConnection conn) - Specified by:
setConnectionin interfaceliquibase.database.Database- Overrides:
setConnectionin classliquibase.database.AbstractJdbcDatabase
-
findDialectName
Called bycreateMetadataSources()to determine the correct dialect name based on url parameters, configuration files, etc. -
getDialect
public org.hibernate.dialect.Dialect getDialect()Returns the dialect determined during database initialization. -
getMetadata
public org.hibernate.boot.Metadata getMetadata() throws liquibase.exception.DatabaseExceptionReturn the hibernateMetadataused by this database.- Throws:
liquibase.exception.DatabaseException
-
getHibernateConnection
Convenience method to return the underlying HibernateConnection in the JdbcConnection returned byAbstractJdbcDatabase.getConnection() -
buildMetadata
protected final org.hibernate.boot.Metadata buildMetadata() throws liquibase.exception.DatabaseExceptionCalled bysetConnection(DatabaseConnection)to create the Metadata stored in this database. If the URL path is configured for aCustomMetadataFactory, create the metadata from that class. Otherwise, it delegates tobuildMetadataFromPath()- Throws:
liquibase.exception.DatabaseException
-
buildMetadataFromPath
protected org.hibernate.boot.Metadata buildMetadataFromPath() throws liquibase.exception.DatabaseExceptionCalled bybuildMetadata()when aCustomMetadataFactoryis not configured. Default implementation passes the results ofcreateMetadataSources()toconfigureSources(MetadataSources)and then callsconfigureMetadataBuilder(MetadataBuilder)but this method can be overridden with any provider-specific implementations needed.- Throws:
liquibase.exception.DatabaseException
-
createMetadataSources
protected org.hibernate.boot.MetadataSources createMetadataSources() throws liquibase.exception.DatabaseExceptionCreates the baseMetadataSourcesto use for this database. Normally, the result of this method is passed throughconfigureSources(MetadataSources).- Throws:
liquibase.exception.DatabaseException
-
configureSources
protected abstract void configureSources(org.hibernate.boot.MetadataSources sources) throws liquibase.exception.DatabaseException Adds any implementation-specific sources to the givenMetadataSources- Throws:
liquibase.exception.DatabaseException
-
configurePhysicalNamingStrategy
protected void configurePhysicalNamingStrategy(String physicalNamingStrategy, org.hibernate.boot.MetadataBuilder builder) throws liquibase.exception.DatabaseException - Throws:
liquibase.exception.DatabaseException
-
configureImplicitNamingStrategy
protected void configureImplicitNamingStrategy(String implicitNamingStrategy, org.hibernate.boot.MetadataBuilder builder) throws liquibase.exception.DatabaseException - Throws:
liquibase.exception.DatabaseException
-
afterSetup
protected void afterSetup()Perform any post-configuration setting logic. -
configureMetadataBuilder
protected void configureMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder) throws liquibase.exception.DatabaseException Called bybuildMetadataFromPath()to do final configuration on theMetadataBuilderbeforeMetadataBuilder.build()is called.- Throws:
liquibase.exception.DatabaseException
-
getProperty
Returns the value of the given property. Should return the value given as a connection URL first, then fall back to configuration-specific values. -
createsIndexesForForeignKeys
public boolean createsIndexesForForeignKeys()- Specified by:
createsIndexesForForeignKeysin interfaceliquibase.database.Database- Overrides:
createsIndexesForForeignKeysin classliquibase.database.AbstractJdbcDatabase
-
getDefaultPort
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns() -
supportsTablespaces
public boolean supportsTablespaces() -
getConnectionCatalogName
- Overrides:
getConnectionCatalogNamein classliquibase.database.AbstractJdbcDatabase- Throws:
liquibase.exception.DatabaseException
-
getConnectionSchemaName
- Overrides:
getConnectionSchemaNamein classliquibase.database.AbstractJdbcDatabase
-
getDefaultSchemaName
- Specified by:
getDefaultSchemaNamein interfaceliquibase.database.Database- Overrides:
getDefaultSchemaNamein classliquibase.database.AbstractJdbcDatabase
-
getDefaultCatalogName
- Specified by:
getDefaultCatalogNamein interfaceliquibase.database.Database- Overrides:
getDefaultCatalogNamein classliquibase.database.AbstractJdbcDatabase
-
isSafeToRunUpdate
public boolean isSafeToRunUpdate() throws liquibase.exception.DatabaseException- Specified by:
isSafeToRunUpdatein interfaceliquibase.database.Database- Overrides:
isSafeToRunUpdatein classliquibase.database.AbstractJdbcDatabase- Throws:
liquibase.exception.DatabaseException
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitivein interfaceliquibase.database.Database- Overrides:
isCaseSensitivein classliquibase.database.AbstractJdbcDatabase
-
supportsSchemas
public boolean supportsSchemas()- Specified by:
supportsSchemasin interfaceliquibase.database.Database- Overrides:
supportsSchemasin classliquibase.database.AbstractJdbcDatabase
-
supportsCatalogs
public boolean supportsCatalogs()- Specified by:
supportsCatalogsin interfaceliquibase.database.Database- Overrides:
supportsCatalogsin classliquibase.database.AbstractJdbcDatabase
-