Top Description Constructors Methods
org.hibernate.tool.schema.extract.internal

public Class InformationExtractorJdbcDatabaseMetaDataImpl

extends AbstractInformationExtractorImpl
Class Inheritance
Imports
java.sql.ResultSet, .ResultSetMetaData, .SQLException, java.util.StringTokenizer, org.hibernate.boot.model.naming.DatabaseIdentifier, .Identifier, org.hibernate.tool.schema.extract.spi.ExtractionContext, .TableInformation

Implementation of the InformationExtractor contract which uses the standard JDBC java.sql.DatabaseMetaData API for extraction.
Authors
Steve Ebersole, Gail Badner

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected String
public <T> T
processCatalogsResultSet(ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processCatalogsResultSet.

Must do the following:
  1. obtain a ResultSet containing a column of existing catalog names. The column label must be the same as returned by getResultSetCatalogLabel.
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.
protected <T> T
processColumnsResultSet(String
– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
catalog
,
String
– a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
schemaPattern
,
String
– a table name pattern; must match the table name as it is stored in the database
tableNamePattern
,
String
– a column name pattern; must match the column name as it is stored in the database
columnNamePattern
,
ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processColumnsResultSet.

Must do the following:
  1. obtain a ResultSet containing a row for any existing catalog/schema/table/column combination as specified by the catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getColumns
protected <T> T
processImportedKeysResultSet(String
– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
catalog
,
String
– a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
schema
,
String
– a table name; must match the table name as it is stored in the database
table
,
ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processImportedKeysResultSet.

Must do the following:
  1. obtain a ResultSet containing a row for each foreign key/ primary key column making up a foreign key for any existing catalog/schema/table combination as specified by the catalog, schema, and table parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getImportedKeys:
protected <T> T
processIndexInfoResultSet(String
– a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
catalog
,
String
– a schema name; must match the schema name as it is stored in this database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
schema
,
String
– a table name; must match the table name as it is stored in this database
table
,
boolean
– when true, return only indices for unique values; when false, return indices regardless of whether unique or not
unique
,
boolean
– when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate
approximate
,
ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processIndexInfoResultSet.

Must do the following:
  1. obtain a ResultSet containing a row for each column defined in an index. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)
protected <T> T
protected <T> T
processSchemaResultSet(String
– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means catalog name should not be used to narrow down the search.
catalog
,
String
– a schema name; must match the schema name as it is stored in the database; null means schema name should not be used to narrow down the search.
schemaPattern
,
ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processSchemaResultSet.

Must do the following:
  1. obtain a ResultSet containing a row for any existing catalog/schema combination as specified by the catalog and schemaPattern parameters described below. The row contents will not be examined by processor.process( resultSet ), so column label names are not specified;
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.
protected <T> T
processTableResultSet(String
- a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
catalog
,
String
- a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
schemaPattern
,
String
- a table name pattern; must match the table name as it is stored in the database
tableNamePattern
,
String[]
- a list of table types
types
,
ExtractionContext.ResultSetProcessor<T>
- the provided ResultSetProcessor.
processor
)

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processTableResultSet.

Must do the following:
  1. obtain a ResultSet containing a row for any existing catalog/schema/table/table type combination as specified by the catalogFilter, schemaFilter, tableNameFilter, and tableTypes parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getTables(String, String, String, String[])
Inherited from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl:
addExtractedColumnInformationcatalogExistsconvertSQLExceptiondetermineCatalogFilterdetermineSchemaFiltergetExtractionContextgetForeignKeysgetIndexesgetPrimaryKeygetResultSetCatalogLabelgetResultSetColumnNameLabelgetResultSetColumnPositionColumngetResultSetColumnSizeLabelgetResultSetDecimalDigitsLabelgetResultSetForeignKeyColumnNameLabelgetResultSetForeignKeyLabelgetResultSetIndexNameLabelgetResultSetIndexTypeLabelgetResultSetIsNullableLabelgetResultSetPrimaryKeyCatalogLabelgetResultSetPrimaryKeyColumnNameLabelgetResultSetPrimaryKeyNameLabelgetResultSetPrimaryKeySchemaLabelgetResultSetPrimaryKeyTableLabelgetResultSetRemarksLabelgetResultSetSchemaLabelgetResultSetSqlTypeCodeLabelgetResultSetTableNameLabelgetResultSetTableTypeLabelgetResultSetTypeNameLabelgetTablegetTablesidentifierHelperinterpretNullableisPhysicalTableTypeschemaExiststoMetaDataObjectName

Constructor Detail

InformationExtractorJdbcDatabaseMetaDataImplback to summary
public InformationExtractorJdbcDatabaseMetaDataImpl(ExtractionContext extractionContext)

Method Detail

addColumnsback to summary
protected void addColumns(TableInformation tableInformation)

Overrides org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.addColumns.

getResultSetTableTypesPhysicalTableConstantback to summary
protected String getResultSetTableTypesPhysicalTableConstant()

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getResultSetTableTypesPhysicalTableConstant.

Annotations
@Override
processCatalogsResultSetback to summary
public <T> T processCatalogsResultSet(ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processCatalogsResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processCatalogsResultSet.

Must do the following:

  1. obtain a ResultSet containing a column of existing catalog names. The column label must be the same as returned by getResultSetCatalogLabel.
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.
Parameters
<T>
- defined by processor
processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs
processColumnsResultSetback to summary
protected <T> T processColumnsResultSet(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processColumnsResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processColumnsResultSet.

Must do the following:

  1. obtain a ResultSet containing a row for any existing catalog/schema/table/column combination as specified by the catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getColumns Rows must be ordered by catalog, schema, table name, and column position.
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.

The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData#getColumns(String, String, String, String), and are copied here:

Parameters
<T>
- defined by processor
catalog:String

– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search

schemaPattern:String

– a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

tableNamePattern:String

– a table name pattern; must match the table name as it is stored in the database

columnNamePattern:String

– a column name pattern; must match the column name as it is stored in the database

processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs
processImportedKeysResultSetback to summary
protected <T> T processImportedKeysResultSet(String catalog, String schema, String table, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processImportedKeysResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processImportedKeysResultSet.

Must do the following:

  1. obtain a ResultSet containing a row for each foreign key/ primary key column making up a foreign key for any existing catalog/schema/table combination as specified by the catalog, schema, and table parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getImportedKeys: The ResultSet must be ordered by the primary key catalog/schema/table and column position within the key.
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.

The catalog, schema, and table parameters are as specified by DatabaseMetaData#getImportedKeys(String, String, String) and are copied here:

Parameters
<T>
- defined by processor
catalog:String

– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search

schema:String

– a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

table:String

– a table name; must match the table name as it is stored in the database

processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs
processIndexInfoResultSetback to summary
protected <T> T processIndexInfoResultSet(String catalog, String schema, String table, boolean unique, boolean approximate, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processIndexInfoResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processIndexInfoResultSet.

Must do the following:

  1. obtain a ResultSet containing a row for each column defined in an index. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean) The ResultSet must be ordered so that the columns for a particular index are in contiguous rows in order of column position.
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.

The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean), and are copied here:

Parameters
<T>
- defined by processor
catalog:String

– a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search

schema:String

– a schema name; must match the schema name as it is stored in this database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

table:String

– a table name; must match the table name as it is stored in this database

unique:boolean

– when true, return only indices for unique values; when false, return indices regardless of whether unique or not

approximate:boolean

– when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate

processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs
processPrimaryKeysResultSetback to summary
protected <T> T processPrimaryKeysResultSet(String catalogFilter, String schemaFilter, Identifier tableName, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processPrimaryKeysResultSet.

Annotations
@Override
processSchemaResultSetback to summary
protected <T> T processSchemaResultSet(String catalog, String schemaPattern, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processSchemaResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processSchemaResultSet.

Must do the following:

  1. obtain a ResultSet containing a row for any existing catalog/schema combination as specified by the catalog and schemaPattern parameters described below. The row contents will not be examined by processor.process( resultSet ), so column label names are not specified;
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.

The catalog and schemaPattern parameters are as specified by DatabaseMetaData#getSchemas(String, String), and are copied here:

Parameters
<T>
- defined by processor
catalog:String

– a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means catalog name should not be used to narrow down the search.

schemaPattern:String

– a schema name; must match the schema name as it is stored in the database; null means schema name should not be used to narrow down the search.

processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs
processTableResultSetback to summary
protected <T> T processTableResultSet(String catalog, String schemaPattern, String tableNamePattern, String[] types, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException

Implements abstract org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processTableResultSet.

Doc from org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.processTableResultSet.

Must do the following:

  1. obtain a ResultSet containing a row for any existing catalog/schema/table/table type combination as specified by the catalogFilter, schemaFilter, tableNameFilter, and tableTypes parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData#getTables(String, String, String, String[])
  2. execute processor.process( resultSet );
  3. release resources whether processor.process( resultSet ) executes successfully or not.

The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData#getTables(String, String, String, String[]), and are copied here:

Parameters
<T>
- defined by processor
catalog:String

- a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search

schemaPattern:String

- a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

tableNamePattern:String

- a table name pattern; must match the table name as it is stored in the database

types:String[]

- a list of table types

processor:ExtractionContext.ResultSetProcessor<T>

- the provided ResultSetProcessor.

Returns:T

- defined by processor

Annotations
@Override
Exceptions
SQLException:
- if a database error occurs