Hi George,
you may also run our CodeGenerator from the command line.
The main class is org.apache.empire.db.codegen.CodeGenerator in
empire-db-codegen-2.4.1.jar.
You should provide the name of a xml config file as an argument, otherwise it
will look for a file config.xml on the path.
Here's an example of what the config looks like:
<config>
<properties>
<!-- provider name must match the property-section containing
the connection data -->
<jdbcClass>oracle.jdbc.driver.OracleDriver</jdbcClass>
<jdbcURL>jdbc:oracle:thin:@192.168.0.2:1521:sid</jdbcURL>
<jdbcUser>DBSAMPLE</jdbcUser>
<jdbcPwd>DBSAMPLE</jdbcPwd>
<!-- Schema options -->
<dbCatalog></dbCatalog>
<dbSchema>DBSAMPLE</dbSchema>
<dbTablePattern></dbTablePattern>
<timestampColumn>CREATIONDATE</timestampColumn>
<!-- generation options -->
<targetFolder>target/generated/dbsample</targetFolder>
<packageName>org.apache.empire.db.samples.dbsample</packageName>
<tablePackageName>org.apache.empire.db.samples.dbsample.tables</tablePackageName>
<viewPackageName>org.apache.empire.db.samples.dbsample.views</viewPackageName>
<recordPackageName>org.apache.empire.db.samples.dbsample.records</recordPackageName>
<dbClassName>SampleDB</dbClassName>
<tableBaseName>SampleTable</tableBaseName>
<viewBaseName>SampleView</viewBaseName>
<recordBaseName>SampleRecord</recordBaseName>
<tableNamePrefix></tableNamePrefix>
<tableClassPrefix>T_</tableClassPrefix>
<tableClassSuffix></tableClassSuffix>
<viewNamePrefix></viewNamePrefix>
<viewClassPrefix>V_</viewClassPrefix>
<viewClassSuffix></viewClassSuffix>
<columnNamePrefix></columnNamePrefix>
<nestTables>true</nestTables>
<nestViews>false</nestViews>
<createRecordProperties>true</createRecordProperties>
<preserverCharacterCase>false</preserverCharacterCase>
<preserveRelationNames>false</preserveRelationNames>
</properties>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="default"
class="org.apache.log4j.ConsoleAppender">
<!-- layout class="org.apache.log4j.TTCCLayout"/ -->
<layout class="org.apache.log4j.PatternLayout">
<!-- param name="ConversionPattern"
value="NSB(%c) %-5p %m at %l%n"/ -->
<param name="ConversionPattern" value="%-5p
[%d{yyyy/MM/dd HH:mm}]: %m at %l %n"/>
</layout>
</appender>
<!-- log detail configuration -->
<logger name="org.apache.empire.commons" additivity="false">
<level value="warn"/>
<appender-ref ref="default"/>
</logger>
<root>
<priority value="info"/>
<appender-ref ref="default"/>
</root>
</log4j:configuration>
</config>
> from: Francis De Brabandere [mailto:[email protected]]
> to: dev
> Re: Loading Database question
>
> Check this example:
> http://svn.apache.org/viewvc/empire-db/trunk/empire-db-
> examples/empire-db-example-codegen/
>
> It uses our maven plugin to generate the java files
>
> Cheers,
> F
>
>
> On 11 June 2013 14:52, George Leon <[email protected]> wrote:
>
> > Hi all
> >
> > I'm looking the empire-db and have a question we have a database with
> > 100 tables is any way to generate reverse engineer the java code for
> > the database in the sample for example do you have a utility to read
> > existing database meta data and create the SampleDB.java ?
> >
> > Thanks
> > George
> >