Package org.hibernate.cfg.reveng

Examples of org.hibernate.cfg.reveng.DefaultDatabaseCollector


    tableSelector = new TableSelectorStrategy(
        new DefaultReverseEngineeringStrategy() );
    reader = JDBCReaderFactory.newJDBCReader( cfg.getProperties(),
        settings, tableSelector );
    dbc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    mapping = cfg.buildMapping();
  }
View Full Code Here


       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
   
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), realMetaData, serviceRegistry );
   
    DatabaseCollector dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, SCHEMA );
   
    assertNotNull("The table should be found", dc.getTable(SCHEMA, null, TABLE1));
    assertNotNull("The table should be found", dc.getTable(SCHEMA, null, TABLE2));
    assertNull("Quoted names should not return the table", dc.getTable(quote(SCHEMA), null, QTABLE1));
    assertNull("Quoted names should not return the table", dc.getTable(quote(SCHEMA), null, QTABLE2));
   
    assertEquals("Foreign key 'masterref' was filtered!", 1, dc.getOneToManyCandidates().size());
  }
View Full Code Here

   
    con = jdbcServices.getConnectionProvider().getConnection();
   
    JDBCMetaDataDialect dialect = new JDBCMetaDataDialect();
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(), jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
    Iterator tables = dialect.getTables( testSettings.getDefaultCatalogName(), testSettings.getDefaultSchemaName(), null );
   
    assertHasNext( 0, tables );
        } finally {
          jdbcServices.getConnectionProvider().closeConnection(con)
View Full Code Here

    MockedMetaDataDialect mockedMetaDataDialect = new MockedMetaDataDialect();
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, tss, mockedMetaDataDialect, serviceRegistry);
   
    tss.addSchemaSelection( new SchemaSelection(null,null, "CHILD") );
   
    DatabaseCollector dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, null );
   
    assertEquals(mockedMetaDataDialect.gottenTables.size(),1);
    assertEquals(mockedMetaDataDialect.gottenTables.get(0),"CHILD");
   
    Iterator iterator = dc.iterateTables();
    Table firstChild = (Table) iterator.next();
    assertEquals(firstChild.getName(), "CHILD");
    assertFalse(iterator.hasNext());
   
    assertFalse("should not record foreignkey to table it doesn't know about yet",firstChild.getForeignKeyIterator().hasNext());
   
    tss.clearSchemaSelections();
    tss.addSchemaSelection( new SchemaSelection(null, null, "MASTER") );
   
    mockedMetaDataDialect.gottenTables.clear();
    reader.readDatabaseSchema( dc, null, null );
   
    assertEquals(mockedMetaDataDialect.gottenTables.size(),1);
    assertEquals(mockedMetaDataDialect.gottenTables.get(0),"MASTER");
   
   
    iterator = dc.iterateTables();
    assertNotNull(iterator.next());
    assertNotNull(iterator.next());
    assertFalse(iterator.hasNext());
   
    Table table = dc.getTable( null, null, "CHILD" );
    assertSame( firstChild, table );
   
    assertHasNext("should have recorded one foreignkey to child table", 1, firstChild.getForeignKeyIterator() );   
   
   
    tss.clearSchemaSelections();   
    reader.readDatabaseSchema( dc, null, null );
   
    Table finalMaster = dc.getTable( null, null, "MASTER" );
   
    assertSame(firstChild, dc.getTable( null, null, "CHILD" ));
    assertHasNext( 1, firstChild.getForeignKeyIterator() );
    assertHasNext( 0, finalMaster.getForeignKeyIterator() );
   
       
  }
View Full Code Here

    MockedMetaDataDialect mock = new MockedMetaDataDialect(realMetaData);
    CachedMetaDataDialect dialect = new CachedMetaDataDialect(mock);
   
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), dialect, serviceRegistry );
   
    DatabaseCollector dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, null );

    validate( dc );   
   
    mock.setFailOnDelegateAccess(true);
   
    reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), dialect, serviceRegistry );
   
    dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, null );

    validate(dc);
   
   
View Full Code Here

    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getTables( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), identifier("tab_master") );
   
    boolean foundMaster = false;
    while(tables.hasNext()) {
View Full Code Here

    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getColumns( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), "test", null );
   
   
    while(tables.hasNext()) {
View Full Code Here

    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getTables( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), identifier( "TAB_MASTER"));
   
    assertHasNext( 1,  tables );
   
View Full Code Here

    tableSelector = new TableSelectorStrategy(
        new DefaultReverseEngineeringStrategy() );
    reader = JDBCReaderFactory.newJDBCReader( cfg.getProperties(),
        settings, tableSelector, serviceRegistry);
    dbc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    mapping = cfg.buildMapping();
  }
View Full Code Here

    tableSelector = new TableSelectorStrategy(
        new DefaultReverseEngineeringStrategy() );
    reader = JDBCReaderFactory.newJDBCReader( cfg.getProperties(),
        settings, tableSelector, serviceRegistry);
    dbc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    mapping = cfg.buildMapping();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.reveng.DefaultDatabaseCollector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.