Search in sources :

Example 1 with DBSchemaTemplateFactory

use of org.whole.lang.rdb.codebase.DBSchemaTemplateFactory in project whole by wholeplatform.

the class ImportSchemaExample method importSchema.

protected void importSchema() throws Exception {
    // create a connection to a local database
    Class.forName("org.h2.Driver");
    Connection connection = DriverManager.getConnection("jdbc:h2:mem:" + DBNAME);
    // reverse engineer
    DBSchemaTemplateFactory dbSchemaTemplateFactory = new DBSchemaTemplateFactory(connection, DBNAME, null);
    Database database = dbSchemaTemplateFactory.create();
    // pretty print the obtained model
    PrettyPrinterOperation.prettyPrint(database);
    connection.close();
}
Also used : DBSchemaTemplateFactory(org.whole.lang.rdb.codebase.DBSchemaTemplateFactory) Connection(java.sql.Connection) Database(org.whole.lang.rdb.model.Database)

Aggregations

Connection (java.sql.Connection)1 DBSchemaTemplateFactory (org.whole.lang.rdb.codebase.DBSchemaTemplateFactory)1 Database (org.whole.lang.rdb.model.Database)1