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; }
@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() ); }
@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; }
private Identifier determineSchemaName(TableSpecificationSource tableSpecSource) { if ( StringHelper.isNotEmpty( tableSpecSource.getExplicitSchemaName() ) ) { return database.toIdentifier( tableSpecSource.getExplicitSchemaName() ); } else { return database.getDefaultNamespace().getName().getSchema(); } }
private Identifier determineCatalogName(TableSpecificationSource tableSpecSource) { if ( StringHelper.isNotEmpty( tableSpecSource.getExplicitCatalogName() ) ) { return database.toIdentifier( tableSpecSource.getExplicitCatalogName() ); } else { return database.getDefaultNamespace().getName().getCatalog(); } }
@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(); } }
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 ); } }
if ( tryToCreateCatalogs || tryToCreateSchemas ) { if ( tryToCreateCatalogs ) { final Identifier catalogLogicalName = namespace.getName().getCatalog(); final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog(); && !existingDatabase.schemaExists( namespace.getName() ) ) { applySqlStrings( false,
tool.getServiceRegistry(), ddlTransactionIsolator, metadata.getDatabase().getDefaultNamespace().getName() );
@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() ); }
final Identifier catalogLogicalName = namespace.getName().getCatalog(); final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
ssr.getService( JdbcEnvironment.class ), new QualifiedNameImpl( namespace.getName(), Identifier.toIdentifier( "aSequence" ) ),
final Identifier catalogLogicalName = namespace.getName().getCatalog(); final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
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 ); }