I too am using the Ant script to reverse engineer a database, and am trying to map table names to classnames using the <table> tag in the reveng.xml file. Like ponticello, I know my <table-filter> tag is working, but cannot get the <table> tag to have any effect; the generated mappings and POJOs always contain the default classnames.
In the <table> tag, I have tried specifying just the name, and also tried specifying the name and schema. Neither attempt worked. There is no catalog name available to me, because my database (MySQL 5.0) by default uses a null catalog name. (I have not found a way to change the catalog name, even as root.) I have tried unqualified class names and fully qualified -- neither worked.
Any idea what the problem is? Do I need to find a way to set the catalog name? Below is the reveng.xml file I am using, and the ant target.
My environment
Windows XP
Hibernate 3.1
hibernate-tools-3.1.0.beta4
MySQL 5.0
My hibernate.reveng.xml file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-name="dd_service"/>
<table schema="data_driven"
name="dd_service"
class="com.tmobile.datadriven.DdServiceImpl"/>
</hibernate-reverse-engineering>
My ant target Code:
<target name="hibernate-mappings" description="Generate hibernate mappings from schema">
<mkdir dir="target/mappings"/>
<hibernatetool destdir="target/mappings">
<classpath refid="hibernate-mappings-classpath"/>
<jdbcconfiguration
configurationfile="config/hibernate.cfg.xml"
revengfile="config/hibernate.reveng.xml"
packagename="com.tmobile.datadriven"
>
</jdbcconfiguration>
<hbm2hbmxml/>
<hbm2java/>
</hibernatetool>
</target>