congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Namespace
Code IndexAdd Tabnine to your IDE (free)

How to use
Namespace
in
org.hibernate.boot.model.relational

Best Java code snippets using org.hibernate.boot.model.relational.Namespace (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

@Override
public java.util.Collection<Table> collectTableMappings() {
  ArrayList<Table> tables = new ArrayList<>();
  for ( Namespace namespace : database.getNamespaces() ) {
    tables.addAll( namespace.getTables() );
  }
  return tables;
}
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 Table(Namespace namespace, String subselect, boolean isAbstract) {
  this.catalog = namespace.getPhysicalName().getCatalog();
  this.schema = namespace.getPhysicalName().getSchema();
  this.subselect = subselect;
  this.isAbstract = isAbstract;
}
origin: hibernate/hibernate-orm

if ( tryToCreateCatalogs || tryToCreateSchemas ) {
  if ( tryToCreateCatalogs ) {
    final Identifier catalogLogicalName = namespace.getName().getCatalog();
    final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
      && namespace.getPhysicalName().getSchema() != null
      && !existingDatabase.schemaExists( namespace.getName() ) ) {
    applySqlStrings(
        false,
        dialect.getCreateSchemaCommand( namespace.getPhysicalName().getSchema().render( dialect ) ),
        formatter,
        options,
origin: hibernate/hibernate-orm

  protected void buildSequence(Database database) {
    final int sourceIncrementSize = getSourceIncrementSize();

    final Namespace namespace = database.locateNamespace(
        logicalQualifiedSequenceName.getCatalogName(),
        logicalQualifiedSequenceName.getSchemaName()
    );
    Sequence sequence = namespace.locateSequence( logicalQualifiedSequenceName.getObjectName() );
    if ( sequence != null ) {
      sequence.validate( initialValue, sourceIncrementSize );
    }
    else {
      sequence = namespace.createSequence( logicalQualifiedSequenceName.getObjectName(), initialValue, sourceIncrementSize );
    }

    this.sequenceName = database.getJdbcEnvironment().getQualifiedObjectNameFormatter().format(
        sequence.getName(),
        database.getJdbcEnvironment().getDialect()
    );
  }
}
origin: hibernate/hibernate-orm

for ( Table table : namespace.getTables() ) {
  if ( !table.isPhysicalTable() ) {
    continue;
for ( Sequence sequence : namespace.getSequences() ) {
  if ( !schemaFilter.includeSequence( sequence ) ) {
    continue;
  if ( tryToDropSchemas && namespace.getPhysicalName().getSchema() != null ) {
    applySqlStrings(
        dialect.getDropSchemaCommand(
            namespace.getPhysicalName().getSchema().render( dialect )
        ),
        formatter,
    final Identifier catalogLogicalName = namespace.getName().getCatalog();
    final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
origin: hibernate/hibernate-orm

tablesInformation.put( namespace, nameSpaceTablesInformation );
if ( schemaFilter.includeNamespace( namespace ) ) {
  for ( Sequence sequence : namespace.getSequences() ) {
    checkExportIdentifier( sequence, exportIdentifiers );
    final SequenceInformation sequenceInformation = existingDatabase.getSequenceInformation( sequence.getName() );
if ( schemaFilter.includeNamespace( namespace ) ) {
  final NameSpaceTablesInformation nameSpaceTablesInformation = tablesInformation.get( namespace );
  for ( Table table : namespace.getTables() ) {
    if ( schemaFilter.includeTable( table ) ) {
      final TableInformation tableInformation = nameSpaceTablesInformation.getTableInformation( table );
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

public void performValidation(
    Metadata metadata,
    DatabaseInformation databaseInformation,
    ExecutionOptions options,
    Dialect dialect) {
  for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
    if ( schemaFilter.includeNamespace( namespace ) ) {
      validateTables( metadata, databaseInformation, options, dialect, namespace );
    }
  }
  for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
    if ( schemaFilter.includeNamespace( namespace ) ) {
      for ( Sequence sequence : namespace.getSequences() ) {
        if ( schemaFilter.includeSequence( sequence ) ) {
          final SequenceInformation sequenceInformation = databaseInformation.getSequenceInformation(
              sequence.getName()
          );
          validateSequence( sequence, sequenceInformation );
        }
      }
    }
  }
}
origin: hibernate/hibernate-orm

    ssr.getService( JdbcEnvironment.class ),
    new QualifiedNameImpl(
        namespace.getName(),
        Identifier.toIdentifier( "aSequence" )
    ),
);
sequenceStructure.registerExportables( database );
exportIdentifierSet.add( namespace.getSequences().iterator().next().getExportIdentifier() );
namespaceSize++;
origin: hibernate/hibernate-orm

    .locateSequence( Identifier.toIdentifier( "my_db_sequence" ) );
assertThat( sequence, notNullValue() );
final String[] sqlCreateStrings = new H2Dialect().getSequenceExporter().getSqlCreateStrings(
origin: hibernate/hibernate-orm

    final Identifier catalogLogicalName = namespace.getName().getCatalog();
    final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
  if ( tryToCreateSchemas && namespace.getPhysicalName().getSchema() != null ) {
    applySqlStrings(
        dialect.getCreateSchemaCommand( namespace.getPhysicalName().getSchema().render( dialect ) ),
        formatter,
        options,
for ( Sequence sequence : namespace.getSequences() ) {
  if ( !schemaFilter.includeSequence( sequence ) ) {
    continue;
for ( Table table : namespace.getTables() ) {
  if ( !table.isPhysicalTable() ){
    continue;
for ( Table table : namespace.getTables() ) {
  if ( !table.isPhysicalTable() ){
    continue;
for ( Table table : namespace.getTables() ) {
  if ( !schemaFilter.includeTable( table ) ) {
    continue;
origin: org.hibernate.ogm/hibernate-ogm-infinispan-remote

@Override
public void initializeSchema(SchemaDefinitionContext context) {
  ServiceRegistryImplementor serviceRegistry = context.getSessionFactory().getServiceRegistry();
  TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );
  OptionsService optionsService = serviceRegistry.getService( OptionsService.class );
  Map tableEntityTypeMapping = context.getTableEntityTypeMapping();
  InfinispanRemoteDatastoreProvider datastoreProvider = (InfinispanRemoteDatastoreProvider) serviceRegistry.getService( DatastoreProvider.class );
  String protobufPackageName = datastoreProvider.getProtobufPackageName();
  SchemaDefinitions sd = new SchemaDefinitions( protobufPackageName );
  HashSet<Sequence> sequences = new HashSet<>();
  for ( Namespace namespace : context.getDatabase().getNamespaces() ) {
    for ( Sequence sequence : namespace.getSequences() ) {
      sequences.add( sequence );
    }
    for ( Table table : namespace.getTables() ) {
      if ( table.isPhysicalTable() ) {
        createTableDefinition( context.getSessionFactory(), sd, table, typeTranslator, protobufPackageName,
          getCacheConfiguration( tableEntityTypeMapping, optionsService, table.getName() )
        );
      }
    }
  }
  for ( IdSourceKeyMetadata iddSourceKeyMetadata : context.getAllIdSourceKeyMetadata() ) {
    if ( !HotRodSequenceCounterHandler.isSequenceGeneratorId( iddSourceKeyMetadata ) ) {
      sd.createSequenceSchemaDefinition( iddSourceKeyMetadata, datastoreProvider.getProtobufPackageName() );
    }
  }
  datastoreProvider.registerSchemaDefinitions( sd, sequences );
}
origin: hibernate/hibernate-orm

@Test
@TestForIssue( jiraKey = "HHH-9936" )
public void testMultipleUsesOfDefaultSequenceName() {
  final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
      .addAnnotatedClass( Entity1.class )
      .addAnnotatedClass( Entity2.class )
      .buildMetadata();
  metadata.validate();
  assertEquals( 0, metadata.getDatabase().getAuxiliaryDatabaseObjects().size() );
  int count = 0;
  for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
    for ( Sequence sequence : namespace.getSequences() ) {
      count++;
    }
  }
  assertEquals( 1, count );
}
origin: hibernate/hibernate-orm

  @Override
  public void registerExportables(Database database) {
    final Namespace namespace = database.locateNamespace(
        logicalQualifiedSequenceName.getCatalogName(),
        logicalQualifiedSequenceName.getSchemaName()
    );
    Sequence sequence = namespace.locateSequence( logicalQualifiedSequenceName.getObjectName() );
    if ( sequence != null ) {
      sequence.validate( 1, 1 );
    }
    else {
      sequence = namespace.createSequence(
          logicalQualifiedSequenceName.getObjectName(),
          1,
          1
      );
    }

    final JdbcEnvironment jdbcEnvironment = database.getJdbcEnvironment();
    final Dialect dialect = jdbcEnvironment.getDialect();

    this.sequenceName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
        sequence.getName(),
        dialect
    );
    this.sql = jdbcEnvironment.getDialect().getSequenceNextValString( sequenceName );
  }
}
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 );
}
origin: hibernate/hibernate-orm

@Override
public java.util.Collection<Table> collectTableMappings() {
  ArrayList<Table> tables = new ArrayList<>();
  for ( Namespace namespace : getDatabase().getNamespaces() ) {
    tables.addAll( namespace.getTables() );
  }
  return tables;
}
origin: hibernate/hibernate-orm

@Test
@TestForIssue( jiraKey = "HHH-9936" )
public void testMultipleUsesOfExplicitSequenceName() {
  final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
      .addAnnotatedClass( Entity3.class )
      .addAnnotatedClass( Entity4.class )
      .buildMetadata();
  metadata.validate();
  assertEquals( 0, metadata.getDatabase().getAuxiliaryDatabaseObjects().size() );
  int count = 0;
  for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
    for ( Sequence sequence : namespace.getSequences() ) {
      count++;
    }
  }
  assertEquals( 1, count );
}
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

public Table(
    Namespace namespace,
    Identifier physicalTableName,
    boolean isAbstract) {
  this.catalog = namespace.getPhysicalName().getCatalog();
  this.schema = namespace.getPhysicalName().getSchema();
  this.name = physicalTableName;
  this.isAbstract = isAbstract;
}
org.hibernate.boot.model.relationalNamespace

Javadoc

Represents a namespace (named schema/catalog pair) with a Database and manages objects defined within.

Most used methods

  • getTables
  • getSequences
  • getName
  • getPhysicalName
  • locateSequence
  • createSequence
  • <init>
  • createDenormalizedTable
  • createTable
    Creates a mapping Table instance.
  • locateTable
    Returns the table with the specified logical table name.

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now