Advanced Database Persistence for Java Examples & Reference Manual |
HotRod is run using an Ant Task. This can be run on the command line or over any IDE such as Eclipse.
The HotRod Ant Task requires the HotRod library to be in the
classpath, as well as the JDBC driver of your particular database.
First, the task needs to be declared in the Ant file using a
<taskdef>
tag as in:
<taskdef name="hotrod" classname="org.hotrod.ant.HotRodAntTask"> <classpath> <pathelement location="lib/hotrod/hotrod-1.0.0.jar" /> <pathelement location="lib/drivers/ojdbc6.jar" /> </classpath> </taskdef>
Once the
hotrod
task is defined it can be used as in:
<hotrod url="jdbc:h2:tcp://localhost:12345/db001" driverclass="org.h2.Driver" username="sa" password="" catalog="DB001" schema="PUBLIC" generator="MyBatis" configfile="hotrod.xml" display="list" />
The
<hotrod>
Ant task parameters are:
Attribute | Description | Required |
---|---|---|
url | The JDBC URL to connect to the live database. | Yes |
driverclass | The driver class of the JDBC driver. | Yes |
username | The database username. | Yes |
password | The database password. | Yes |
catalog | The database catalog. If not known, leave it blank and run HotRod to list all available values. | Yes |
schema | The database schema. If not known, leave it blank and run HotRod to list all available values. | Yes |
generator | Currently the MyBatis generator is fully supported. The SpringJDBC generator is in experimental mode. | Yes |
configfile | The location of the configuration file that includes all tables, view, SQL, etc. | Yes |
facets | The comma-separated list of facets that will be included in the code generation. If left blank, all facets are included. | No |
display | Controls how much details the HotRod task shows when running: list shows the list of the included database objects as well as the summary; summary only includes the summary line. Defaults to list. | No |