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

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

Best Java code snippets using org.hibernate.boot.model.relational.Namespace.getTables (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

@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

private void assertNoForeignKey(String foreignKeyName, String... columns) {
  Set<String> columnSet = new LinkedHashSet<>( Arrays.asList( columns ) );
  for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
    for ( org.hibernate.mapping.Table table : namespace.getTables() ) {
      Iterator<org.hibernate.mapping.ForeignKey> fkItr = table.getForeignKeyIterator();
      while ( fkItr.hasNext() ) {
        org.hibernate.mapping.ForeignKey fk = fkItr.next();
        assertFalse(
            "ForeignKey [" + foreignKeyName + "] defined and shouldn't have been.",
            foreignKeyName.equals( fk.getName() )
        );
      }
    }
  }
}
origin: hibernate/hibernate-orm

  @Override
  protected void validateTables(
      Metadata metadata,
      DatabaseInformation databaseInformation,
      ExecutionOptions options,
      Dialect dialect,
      Namespace namespace) {
    for ( Table table : namespace.getTables() ) {
      if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
        final TableInformation tableInformation = databaseInformation.getTableInformation(
            table.getQualifiedTableName()
        );
        validateTable( table, tableInformation, metadata, options, dialect );
      }
    }
  }
}
origin: hibernate/hibernate-orm

  @Override
  protected void validateTables(
      Metadata metadata,
      DatabaseInformation databaseInformation,
      ExecutionOptions options,
      Dialect dialect, Namespace namespace) {

    final NameSpaceTablesInformation tables = databaseInformation.getTablesInformation( namespace );
    for ( Table table : namespace.getTables() ) {
      if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
        validateTable(
            table,
            tables.getTableInformation( table ),
            metadata,
            options,
            dialect
        );
      }
    }
  }
}
origin: hibernate/hibernate-orm

private void applyConstraintDropping(
    Namespace namespace,
    Metadata metadata,
    Formatter formatter,
    ExecutionOptions options,
    GenerationTarget... targets) {
  final Dialect dialect = metadata.getDatabase().getJdbcEnvironment().getDialect();
  if ( !dialect.dropConstraints() ) {
    return;
  }
  for ( Table table : namespace.getTables() ) {
    if ( !table.isPhysicalTable() ) {
      continue;
    }
    if ( !schemaFilter.includeTable( table ) ) {
      continue;
    }
    final Iterator fks = table.getForeignKeyIterator();
    while ( fks.hasNext() ) {
      final ForeignKey foreignKey = (ForeignKey) fks.next();
      applySqlStrings(
          dialect.getForeignKeyExporter().getSqlDropStrings( foreignKey, metadata ),
          formatter,
          options,
          targets
      );
    }
  }
}
origin: hibernate/hibernate-orm

private void assertForeignKey(String foreignKeyName, String... columns) {
  Set<String> columnSet = new LinkedHashSet<>( Arrays.asList( columns ) );
  for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
    for ( org.hibernate.mapping.Table table : namespace.getTables() ) {
      Iterator<org.hibernate.mapping.ForeignKey> fkItr = table.getForeignKeyIterator();
      while ( fkItr.hasNext() ) {
        org.hibernate.mapping.ForeignKey fk = fkItr.next();
        if ( foreignKeyName.equals( fk.getName() ) ) {
          assertEquals( "ForeignKey column count not like expected", columnSet.size(), fk.getColumnSpan() );
          List<String> columnNames = fk.getColumns().stream().map(Column::getName).collect(Collectors.toList());
          assertTrue(
              "ForeignKey columns [" + columnNames + "] do not match expected columns [" + columnSet + "]",
              columnSet.containsAll( columnNames )
          );
          return;
        }
      }
    }
  }
  fail( "ForeignKey '" + foreignKeyName + "' could not be found!" );
}
origin: hibernate/hibernate-orm

@Test
@TestForIssue(jiraKey = "HHH-12975")
public void testPrimaryKeyJoinColumnForeignKeyNoConstraint() {
  for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
    for ( Table table : namespace.getTables() ) {
      if ( "Car".equals( table.getName() ) ) {
        assertEquals( 0, table.getForeignKeys().size() );
      }
    }
  }
}
origin: hibernate/hibernate-orm

@Test
@TestForIssue(jiraKey = "HHH-12975")
public void testMapsIdJoinColumnForeignKeyNoConstraint() {
  for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
    for ( Table table : namespace.getTables() ) {
      if ( "Post".equals( table.getName() ) ) {
        assertEquals( 0, table.getForeignKeys().size() );
      }
    }
  }
}
origin: hibernate/hibernate-orm

@Test
public void testJoinTableForeignKeyToNonAuditTables() {
  // there should only be references to REVINFO and not to the Customer or Address tables
  for ( Table table : metadata().getDatabase().getDefaultNamespace().getTables() ) {
    if ( table.getName().equals( "CustomerAddress_AUD" ) ) {
      for ( org.hibernate.mapping.ForeignKey foreignKey : table.getForeignKeys().values() ) {
        assertEquals( "REVINFO", foreignKey.getReferencedTable().getName() );
      }
    }
  }
}
origin: hibernate/hibernate-orm

  @Test
  public void testForeignKeyNameSetForMapsIdJoinColumn() {
    for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
      for ( Table table : namespace.getTables() ) {
        if ( table.getName().equals( "Post" ) ) {
          Iterator<org.hibernate.mapping.ForeignKey> foreignKeyIterator = table.getForeignKeyIterator();
          while ( foreignKeyIterator.hasNext() ) {
            org.hibernate.mapping.ForeignKey foreignKey = foreignKeyIterator.next();
            if ( foreignKey.getColumn( 0 ).getName().equals( "PD_ID" ) ) {
              assertEquals( "FK_PD", foreignKey.getName() );
              return;
            }
          }
        }
      }
    }
    fail( "Expected to find a Foreign Key mapped to column PD_ID but failed to locate it" );
  }
}
origin: hibernate/hibernate-orm

@Test
@TestForIssue( jiraKey = "HHH-9850" )
public void testNewGeneratorTableCreationOnDb2() {
  StandardServiceRegistry ssr = new StandardServiceRegistryBuilder()
      .applySetting( AvailableSettings.DIALECT, DB2Dialect.class.getName() )
      .build();
  try {
    Metadata metadata = new MetadataSources( ssr )
        .buildMetadata();
    assertEquals( 0, metadata.getDatabase().getDefaultNamespace().getTables().size() );
    TableGenerator generator = new TableGenerator();
    Properties properties = new Properties();
    generator.configure( IntegerType.INSTANCE, properties, ssr );
    generator.registerExportables( metadata.getDatabase() );
    assertEquals( 1, metadata.getDatabase().getDefaultNamespace().getTables().size() );
    final Table table = metadata.getDatabase().getDefaultNamespace().getTables().iterator().next();
    final String[] createCommands = new DB2Dialect().getTableExporter().getSqlCreateStrings( table, metadata );
    assertContains( "sequence_name varchar(255) not null", createCommands[0] );
  }
  finally {
    StandardServiceRegistryBuilder.destroy( ssr );
  }
}
origin: hibernate/hibernate-orm

    .buildMetadata();
assertEquals( 0, metadata.getDatabase().getDefaultNamespace().getTables().size() );
assertEquals( 1, metadata.getDatabase().getDefaultNamespace().getTables().size() );
final Table table = metadata.getDatabase().getDefaultNamespace().getTables().iterator().next();
final String[] createCommands = new DB2Dialect().getTableExporter().getSqlCreateStrings( table, metadata );
assertContains( "sequence_name varchar(255) not null", createCommands[0] );
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

int foundCount = 0;
for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
  for ( org.hibernate.mapping.Table table : namespace.getTables() ) {
    Iterator fkItr = table.getForeignKeyIterator();
    while (fkItr.hasNext()) {
origin: hibernate/hibernate-orm

    targets
);
for ( Table table : namespace.getTables() ) {
  if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
    checkExportIdentifier( table, exportIdentifiers );
for ( Table table : namespace.getTables() ) {
  if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
    final TableInformation tableInformation = tablesInformation.getTableInformation( table );
origin: hibernate/hibernate-orm

);
final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation( namespace );
for ( Table table : namespace.getTables() ) {
  if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
    checkExportIdentifier( table, exportIdentifiers );
for ( Table table : namespace.getTables() ) {
  if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
    final TableInformation tableInformation = tablesInformation.getTableInformation( table );
origin: hibernate/hibernate-orm

  @Test
  public void testIdentifierGeneratorExtendsIdentityGenerator() {
    final MetadataSources sources = new MetadataSources( serviceRegistry() );
    sources.addAnnotatedClass( EntityBean.class );

    final MetadataBuilder builder = sources.getMetadataBuilder();
    final Metadata metadata = builder.build();


    for ( final Namespace ns : metadata.getDatabase().getNamespaces() ) {
      for ( final org.hibernate.mapping.Table table : ns.getTables() ) {
        final KeyValue value = table.getIdentifierValue();
        assertNotNull( "IdentifierValue was null", value );
        assertTrue( value.isIdentityColumn( metadata.getIdentifierGeneratorFactory(), getDialect() ) );
      }
    }
    
    Session s = openSession();
    s.beginTransaction();
    s.save( new EntityBean() );
    s.getTransaction().commit();
    s.close();
  }
}
origin: hibernate/hibernate-orm

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

for ( Table table : namespace.getTables() ) {
  if ( !table.isPhysicalTable() ) {
    continue;
org.hibernate.boot.model.relationalNamespacegetTables

Popular methods of Namespace

  • 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

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Best IntelliJ plugins
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