Package liquibase.ext.hibernate.database
Class HibernateDatabase
- java.lang.Object
-
- liquibase.database.AbstractJdbcDatabase
-
- liquibase.ext.hibernate.database.HibernateDatabase
-
- All Implemented Interfaces:
liquibase.database.Database,liquibase.servicelocator.PrioritizedService
- Direct Known Subclasses:
HibernateClassicDatabase,HibernateEjb3Database,HibernateSpringBeanDatabase
public abstract class HibernateDatabase extends liquibase.database.AbstractJdbcDatabaseBase 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
Fields Modifier and Type Field Description static StringDEFAULT_SCHEMAprotected org.hibernate.dialect.Dialectdialect-
Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
-
-
Constructor Summary
Constructors Constructor Description HibernateDatabase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidafterSetup()Perform any post-configuration setting logic.protected org.hibernate.boot.MetadatabuildMetadata()Called bysetConnection(DatabaseConnection)to create the Metadata stored in this database.protected org.hibernate.boot.MetadatabuildMetadataFromPath()Called 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 voidconfigureNewIdentifierGeneratorSupport(String value, org.hibernate.boot.MetadataBuilder builder)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.MetadataSourcescreateMetadataSources()Creates the baseMetadataSourcesto use for this database.booleancreatesIndexesForForeignKeys()protected StringfindDialectName()Called bycreateMetadataSources()to determine the correct dialect name based on url parameters, configuration files, etc.protected StringgetConnectionCatalogName()protected StringgetConnectionSchemaName()StringgetDefaultCatalogName()StringgetDefaultDriver(String url)IntegergetDefaultPort()StringgetDefaultSchemaName()org.hibernate.dialect.DialectgetDialect()Returns the dialect determined during database initialization.protected HibernateConnectiongetHibernateConnection()Convenience method to return the underlying HibernateConnection in the JdbcConnection returned byAbstractJdbcDatabase.getConnection()org.hibernate.boot.MetadatagetMetadata()Return the hibernateMetadataused by this database.intgetPriority()StringgetProperty(String name)Returns the value of the given property.booleanisCaseSensitive()booleanisSafeToRunUpdate()booleanrequiresPassword()booleanrequiresUsername()voidsetConnection(liquibase.database.DatabaseConnection conn)booleansupportsCatalogs()booleansupportsInitiallyDeferrableColumns()booleansupportsSchemas()booleansupportsTablespaces()-
Methods 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, 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, validate
-
-
-
-
Field Detail
-
dialect
protected org.hibernate.dialect.Dialect dialect
-
DEFAULT_SCHEMA
public static final String DEFAULT_SCHEMA
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
getPriority
public int getPriority()
-
setConnection
public void setConnection(liquibase.database.DatabaseConnection conn)
- Specified by:
setConnectionin interfaceliquibase.database.Database- Overrides:
setConnectionin classliquibase.database.AbstractJdbcDatabase
-
findDialectName
protected String 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
protected HibernateConnection 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.DatabaseExceptionAdds any implementation-specific sources to the givenMetadataSources- Throws:
liquibase.exception.DatabaseException
-
configureNewIdentifierGeneratorSupport
protected void configureNewIdentifierGeneratorSupport(String value, org.hibernate.boot.MetadataBuilder builder) throws liquibase.exception.DatabaseException
- 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.DatabaseExceptionCalled bybuildMetadataFromPath()to do final configuration on theMetadataBuilderbeforeMetadataBuilder.build()is called.- Throws:
liquibase.exception.DatabaseException
-
getProperty
public String getProperty(String name)
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
public Integer getDefaultPort()
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()
-
supportsTablespaces
public boolean supportsTablespaces()
-
getConnectionCatalogName
protected String getConnectionCatalogName() throws liquibase.exception.DatabaseException
- Overrides:
getConnectionCatalogNamein classliquibase.database.AbstractJdbcDatabase- Throws:
liquibase.exception.DatabaseException
-
getConnectionSchemaName
protected String getConnectionSchemaName()
- Overrides:
getConnectionSchemaNamein classliquibase.database.AbstractJdbcDatabase
-
getDefaultSchemaName
public String getDefaultSchemaName()
- Specified by:
getDefaultSchemaNamein interfaceliquibase.database.Database- Overrides:
getDefaultSchemaNamein classliquibase.database.AbstractJdbcDatabase
-
getDefaultCatalogName
public String 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
-
-