|
JET Code Generator - How it Works
In general, the use of the generator is a three step process, however
both steps do not have to occur every time it is used.
| Step 1 |
Use DBtoXML to attach to your database and generate
an xml file representing your schema. This should be done
at a minimum any time your schema changes. (If the schema is
stable, this file may be checked into your version control system.)
<?xml version ="1.0"?>
<database name="db" >
<table name="book" javaname="Book" type="TABLE" >
<primary_keys>
<column>
<javatype>String</javatype>
<javaname>Isbn</javaname>
<rsgetter>String</rsgetter>
<name>isbn</name>
<type>CHAR</type>
</column>
</primary_keys>
<column>
<javatype>String</javatype>
<javaname>Isbn</javaname>
<rsgetter>String</rsgetter>
<name>isbn</name>
<type>CHAR</type>
</column>
...
</table>
</db>
|
| Example generated db.xml |
|
| Step 2 |
Use the XMLDBProcessor and/or
the XMLTableProcessor along with
custom written XSLTs to generate code based on the database
schema xml file.
The sample XSLT is a bit large to display
inline, so it is included as a link.
|
| Step 3 |
Build the code along with the rest of your system. |
Ultimately, you can determine the best way to use the code generator
within your build system.
The examples make use of the ANT build system, available from
here. If you havn't
tried ANT yet, give it a shot.
|
|
|