org.hibernate.boot.model.relational.Namespace.getName()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.hibernate.boot.model.relational.Namespace.getName()方法的一些代码示例,展示了Namespace.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getName()方法的具体详情如下:
包路径:org.hibernate.boot.model.relational.Namespace
类名称:Namespace
方法名:getName

Namespace.getName介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public Namespace adjustDefaultNamespace(Identifier catalogName, Identifier schemaName) {
  final Namespace.Name name = new Namespace.Name( catalogName, schemaName );
  if ( implicitNamespace.getName().equals( name ) ) {
    return implicitNamespace;
  }
  Namespace namespace = namespaceMap.get( name );
  if ( namespace == null ) {
    namespace = makeNamespace( name );
  }
  implicitNamespace = namespace;
  return implicitNamespace;
}

代码示例来源:origin: hibernate/hibernate-orm

public Settings(SessionFactoryOptions sessionFactoryOptions, Metadata metadata) {
  this(
      sessionFactoryOptions,
      extractName( metadata.getDatabase().getDefaultNamespace().getName().getCatalog() ),
      extractName( metadata.getDatabase().getDefaultNamespace().getName().getSchema() )
  );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public boolean includeNamespace(Namespace namespace) {
  // exclude schema "the_catalog_2"
  Identifier identifier = namespace.getName().getCatalog();
  return identifier == null || !"the_catalog_2".equals( identifier.getText() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public boolean includeNamespace(Namespace namespace) {
  // exclude schema "the_schema_2"
  Identifier identifier = namespace.getName().getSchema();
  if ( identifier != null ) {
    return !"the_schema_2".equals( identifier.getText() );
  }
  return true;
}

代码示例来源:origin: hibernate/hibernate-orm

private Identifier determineSchemaName(TableSpecificationSource tableSpecSource) {
  if ( StringHelper.isNotEmpty( tableSpecSource.getExplicitSchemaName() ) ) {
    return database.toIdentifier( tableSpecSource.getExplicitSchemaName() );
  }
  else {
    return database.getDefaultNamespace().getName().getSchema();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private Identifier determineCatalogName(TableSpecificationSource tableSpecSource) {
  if ( StringHelper.isNotEmpty( tableSpecSource.getExplicitCatalogName() ) ) {
    return database.toIdentifier( tableSpecSource.getExplicitCatalogName() );
  }
  else {
    return database.getDefaultNamespace().getName().getCatalog();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void doValidation(Metadata metadata, ExecutionOptions options) {
  final JdbcContext jdbcContext = tool.resolveJdbcContext( options.getConfigurationValues() );
  final DdlTransactionIsolator isolator = tool.getDdlTransactionIsolator( jdbcContext );
  final DatabaseInformation databaseInformation = Helper.buildDatabaseInformation(
      tool.getServiceRegistry(),
      isolator,
      metadata.getDatabase().getDefaultNamespace().getName()
  );
  try {
    performValidation( metadata, databaseInformation, options, jdbcContext.getDialect() );
  }
  finally {
    try {
      databaseInformation.cleanup();
    }
    catch (Exception e) {
      log.debug( "Problem releasing DatabaseInformation : " + e.getMessage() );
    }
    isolator.release();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private void processExportableProducers() {
  // for now we only handle id generators as ExportableProducers
  final Dialect dialect = getDatabase().getJdbcEnvironment().getDialect();
  final String defaultCatalog = extractName( getDatabase().getDefaultNamespace().getName().getCatalog(), dialect );
  final String defaultSchema = extractName( getDatabase().getDefaultNamespace().getName().getSchema(), dialect );
  for ( PersistentClass entityBinding : entityBindingMap.values() ) {
    if ( entityBinding.isInherited() ) {
      continue;
    }
    handleIdentifierValueBinding(
        entityBinding.getIdentifier(),
        dialect,
        defaultCatalog,
        defaultSchema,
        (RootClass) entityBinding
    );
  }
  for ( Collection collection : collectionBindingMap.values() ) {
    if ( !IdentifierCollection.class.isInstance( collection ) ) {
      continue;
    }
    handleIdentifierValueBinding(
        ( (IdentifierCollection) collection ).getIdentifier(),
        dialect,
        defaultCatalog,
        defaultSchema,
        null
    );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

if ( tryToCreateCatalogs || tryToCreateSchemas ) {
  if ( tryToCreateCatalogs ) {
    final Identifier catalogLogicalName = namespace.getName().getCatalog();
    final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
      && !existingDatabase.schemaExists( namespace.getName() ) ) {
    applySqlStrings(
        false,

代码示例来源:origin: hibernate/hibernate-orm

tool.getServiceRegistry(),
    ddlTransactionIsolator,
    metadata.getDatabase().getDefaultNamespace().getName()
);

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testQualifiedNameSeparator() throws Exception {
  Namespace.Name namespaceName = new Namespace.Name(
      Identifier.toIdentifier( "DB1" ),
      Identifier.toIdentifier( "PUBLIC" )
  );
  String expectedName = null;
  for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
    if ( !namespace.getName().equals( namespaceName ) ) {
      continue;
    }
    assertEquals( 1, namespace.getTables().size() );
    expectedName = metadata().getDatabase().getJdbcEnvironment().getQualifiedObjectNameFormatter().format(
        namespace.getTables().iterator().next().getQualifiedTableName(),
        getDialect()
    );
  }
  assertNotNull( expectedName );
  SingleTableEntityPersister persister = (SingleTableEntityPersister) sessionFactory().getEntityPersister( Box.class.getName() );
  assertEquals( expectedName, persister.getTableName() );
}

代码示例来源:origin: hibernate/hibernate-orm

final Identifier catalogLogicalName = namespace.getName().getCatalog();
final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();

代码示例来源:origin: hibernate/hibernate-orm

ssr.getService( JdbcEnvironment.class ),
new QualifiedNameImpl(
    namespace.getName(),
    Identifier.toIdentifier( "aSequence" )
),

代码示例来源:origin: hibernate/hibernate-orm

final Identifier catalogLogicalName = namespace.getName().getCatalog();
final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();

代码示例来源:origin: hibernate/hibernate-orm

private InformationExtractorJdbcDatabaseMetaDataImplTest buildInformationExtractorJdbcDatabaseMetaDataImplTest()
    throws SQLException {
  Database database = metadata.getDatabase();
  final ConnectionProvider connectionProvider = ssr.getService( ConnectionProvider.class );
  DatabaseInformation dbInfo = new DatabaseInformationImpl(
      ssr,
      database.getJdbcEnvironment(),
      new DdlTransactionIsolatorTestingImpl( ssr,
                          new JdbcEnvironmentInitiator.ConnectionProviderJdbcConnectionAccess(
                              connectionProvider )
      ),
      database.getDefaultNamespace().getName()
  );
  ExtractionContextImpl extractionContext = new ExtractionContextImpl(
      ssr,
      database.getJdbcEnvironment(),
      ssr.getService( JdbcServices.class ).getBootstrapJdbcConnectionAccess(),
      (ExtractionContext.DatabaseObjectAccess) dbInfo,
      database.getDefaultNamespace().getPhysicalName().getCatalog(),
      database.getDefaultNamespace().getPhysicalName().getSchema()
  );
  return new InformationExtractorJdbcDatabaseMetaDataImplTest(
      extractionContext );
}

相关文章