Documentation » Reverse Engineering Download

Database Reverse Engineering

Empire-db codegen allows you to generate your data model definition from an existing database.

This instruction will show you two possibilities by using the codegen project of Empire-db.

1. Generating with an IDE

  1. First you have to check out the latest version of Empire-db from the following svn repository:
  2. Create a new workspace (e.g. with Eclipse) and import the Empire-db projects to your workspace.
  3. As next point you have to configure the config.xml which you will found in the empire-db-codegen project. The single properties of the config.xml will be explained at the end of the page.
  4. After configuring the config.xml you can start the DDL generation by executing the Class in the empire-db-codegen project.

2. Generating with Maven

  1. First you have to create a config.xml where the connection and generation options must be set. To configure your config.xml use the properties from the table at the end of this page.
    The following code will show you an example configuration:
    <?xml version="1.0" encoding="UTF-8"?>
            <!-- Schema options -->
            <!-- generation options -->
  2. Next you have to customize your pom.xml. As first step you have to add a dependency to the empire-db codegen.
    For example:
    After adding the dependency you have to add the plugin empire-db-maven-plugin.
    This could look like this:
    In the configuration node you specify the path to your <configFile>. Alternatively, instead of a config file you can specify your config properties directly in the configuration section such as <jdbcClass> and <jdbcURL> etc.
  3. After customizing your pom.xml you can start the DDL generation. Open your command line and go to the root directory of your project. Start the generation by executing the following command: mvn generate-sources.

Property Explanation

Property Explanation
jdbcClass The JDBC class. For example: "oracle.jdbc.driver.OracleDriver".
jdbcURL The URL to the database, e.g. "jdbc:oracle:thin:@".
jdbcUser Setting the username.
jdbcPwd Setting the password.
dbSchema Setting the schema of the database.
dbTablePattern Pattern for the table and view names. Setting dbTablePattern to "%RI%" will generate only the tables and views which containing "RI" in their names.
timestampColumn The name of the timestamp column. For example "UPDATE_TIMESTAMP".
targetFolder The folder where the generated files get saved.
packageName Name of the package.
tablePackageName Package name for the tables.
viewPackageName Package name for the views.
recordPackageName Package name for the records.
dbClassName Database class name.
tableBaseName Class name for the base table (super class of all tables).
viewBaseName Class name for the base view (super class of all views).
recordBaseName Class name for the base record (super class of all records).
tableNamePrefix Sets a prefix for the table names. Example for the table "User" with the prefix "Tbl": The selected table name for the table "User" would be "TblUSER". In the Database class it would be like: "User TblUSER = new User()".
tableClassPrefix Sets a prefix for the table classes. For example the prefix "T_": The name of every table class will start with "T_".
tableClassSuffix Sets a suffix for the table classes. Similar to the property tableClassPrefix.
viewNamePrefix Sets a prefix for the view names.
viewClassPrefix Sets a prefix for the view classes.
viewClassSuffix Sets a suffix for the view classes.
columnNamePrefix Sets a prefix for the column names.
nestTables When setting nestTable to "true", every table will be generated as a nested class (inner class) in the database class.
nestViews Similar to nestTables but with views.
createRecordProperties Setting createRecordProperties to "true", will generating the getter and setter methods for every column in the associated table.
preserverCharacterCase Setting this property to "true" – The names for the tables and views will be kept.
Setting to "false" – Class names will be in camel case.
preserveRelationNames Setting this property to "true" – The names of the relations that were setting in the database will be preserved.
Setting to "false" – The relations will be unnamed.