@Override public Collection<Table> collectTableMappings() { return delegate.collectTableMappings(); }
@Test public void testAbstractTableExistence() { for ( Table table : metadata().collectTableMappings() ) { if ( "AbstractEntity_AUD".equals( table.getName() ) ) { Assert.assertFalse( table.isPhysicalTable() ); return; } } Assert.fail(); } }
@Test public void testJoinTableSchemaName() { for ( Table table : metadata().collectTableMappings() ) { if ( TABLE_NAME.equals( table.getName() ) ) { Assert.assertEquals( SCHEMA_NAME, table.getSchema() ); return; } } Assert.fail(); }
/** * Column aliases utilize {@link Table#getUniqueInteger()} for naming. The unique integer used to be statically * generated by the Table class, meaning it was dependent on mapping order. HHH-2448 made the alias names * deterministic by having Configuration determine the unique integers on its second pass over the Tables tree map. * AliasTest and {@link MappingReorderedAliasTest} ensure that the unique integers are the same, regardless of * mapping ordering. */ @Test @TestForIssue( jiraKey = "HHH-2448" ) public void testAliasOrdering() { Iterator<Table> tables = metadata().collectTableMappings().iterator(); Table table1 = null; Table table2 = null; while ( tables.hasNext() ) { Table table = tables.next(); if ( table.getName().equals( "Table1" ) ) { table1 = table; } else if ( table.getName().equals( "Table2" ) ) { table2 = table; } } assertTrue( table1.getUniqueInteger() < table2.getUniqueInteger() ); }
@Test public void testRevEntityTableCreation() { for ( Table table : metadata().collectTableMappings() ) { if ( "REVCHANGES".equals( table.getName() ) ) { assert table.getColumnSpan() == 2; assert table.getColumn( new Column( "REV" ) ) != null; assert table.getColumn( new Column( "ENTITYNAME" ) ) != null; return; } } assert false; }
for ( Table table : metadata.collectTableMappings() ) { for ( Map.Entry<ForeignKeyKey, ForeignKey> entry : table.getForeignKeys().entrySet() ) { assertFalse(
@Override public Collection<Table> collectTableMappings() { return delegate.collectTableMappings(); }
protected org.hibernate.mapping.Table findHibernateTable(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException { HibernateDatabase database = (HibernateDatabase) snapshot.getDatabase(); MetadataImplementor metadata = (MetadataImplementor) database.getMetadata(); Collection<Table> tmapp = metadata.collectTableMappings(); Iterator<Table> tableMappings = tmapp.iterator(); while (tableMappings.hasNext()) { org.hibernate.mapping.Table hibernateTable = tableMappings.next(); if (hibernateTable.getName().equalsIgnoreCase(example.getName())) { return hibernateTable; } } return null; } }
private Table findTableMapping(String tableName) { configure(); Collection<Table> tableMappings = metadataImplementor.collectTableMappings(); for ( Table table : tableMappings ) { if (tableName.equals(table.getName())) return table; } throw new JbpmException("no mapping found for table: " + tableName); }
MetadataImplementor metadata = (MetadataImplementor) database.getMetadata(); Collection<org.hibernate.mapping.Table> tmapp = metadata.collectTableMappings(); Iterator<org.hibernate.mapping.Table> tableMappings = tmapp.iterator(); while (tableMappings.hasNext()) {