下面列出了org.hibernate.boot.model.relational.Namespace#Name ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public DatabaseInformationImpl(
ServiceRegistry serviceRegistry,
JdbcEnvironment jdbcEnvironment,
DdlTransactionIsolator ddlTransactionIsolator,
Namespace.Name defaultNamespace) throws SQLException {
this.jdbcEnvironment = jdbcEnvironment;
this.extractionContext = new ImprovedExtractionContextImpl(
serviceRegistry,
jdbcEnvironment,
ddlTransactionIsolator,
defaultNamespace.getCatalog(),
defaultNamespace.getSchema(),
this
);
// todo : make this pluggable
this.extractor = new InformationExtractorJdbcDatabaseMetaDataImpl( extractionContext );
// because we do not have defined a way to locate sequence info by name
initializeSequences();
}
public static DatabaseInformation buildDatabaseInformation(
ServiceRegistry serviceRegistry,
DdlTransactionIsolator ddlTransactionIsolator,
Namespace.Name defaultNamespace) {
final JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class );
try {
return new DatabaseInformationImpl(
serviceRegistry,
jdbcEnvironment,
ddlTransactionIsolator,
defaultNamespace
);
}
catch (SQLException e) {
throw jdbcEnvironment.getSqlExceptionHelper().convert( e, "Unable to build DatabaseInformation" );
}
}
@Override
public boolean schemaExists(Namespace.Name namespace) {
return extractor.schemaExists( namespace.getCatalog(), namespace.getSchema() );
}
@Override
public TableInformation getTableInformation(
Namespace.Name namespace,
Identifier tableName) {
return getTableInformation( new QualifiedTableName( namespace, tableName ) );
}
@Override
public SequenceInformation getSequenceInformation(Namespace.Name schemaName, Identifier sequenceName) {
return getSequenceInformation( new QualifiedSequenceName( schemaName, sequenceName ) );
}
/**
* Check to see if the given schema already exists.
*
* @param schema The schema name
*
* @return {@code true} indicates a schema with the given name already exists
*/
boolean schemaExists(Namespace.Name schema);
/**
* Obtain reference to the named TableInformation
*
* @param schemaName The name of the schema the table belongs to
* @param tableName The table name
*
* @return The table information. May return {@code null} if not found.
*/
TableInformation getTableInformation(Namespace.Name schemaName, Identifier tableName);
/**
* Obtain reference to the named SequenceInformation
*
* @param schemaName The name of the schema the table belongs to
* @param sequenceName The sequence name
*
* @return The sequence information. May return {@code null} if not found.
*/
SequenceInformation getSequenceInformation(Namespace.Name schemaName, Identifier sequenceName);