I'm having some trouble with the ant task. I publish a JPA-using opensource project and want to generate DDL files for several different database dialects to include in the distribution, including DDL for databases I don't have running anywhere.
My first attempt looks like this:
Code:
<hibernatetool destdir="${build.dir}/ddl">
<classpath ...blah blah
<property key="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<jpaconfiguration persistenceunit="subetha" />
<hbm2ddl format="true" outputfilename="mysql5.sql" />
</hibernatetool>
However, the task complains that I must specify a dialect. It appears that you cannot specify a dialect with a <property>. I did, however, find an undocumented "propertyfile" attribute on <jpaconfiguration>, so I've tried this:
Code:
<hibernatetool destdir="${build.dir}/ddl">
<classpath ...blah blah
<jpaconfiguration persistenceunit="subetha" propertyfile="mysql5.properties"/>
<hbm2ddl format="true" outputfilename="mysql5.sql" />
</hibernatetool>
Where mysql.properties contains "hibernate.dialect=org.hibernate.dialect.MySQL5Dialect". Now this produces an error "unable to find datasource". That makes some amount of sense, hbm2ddl normally updates the DB. So I try setting <hbm2ddl export="false":
Code:
<hibernatetool destdir="${build.dir}/ddl">
<classpath ...blah blah
<jpaconfiguration persistenceunit="subetha" propertyfile="mysql5.properties"/>
<hbm2ddl export="false" format="true" outputfilename="mysql5.sql" />
</hibernatetool>
This runs successfully but mysql5.sql is an empty (0-byte) file.
What am I missing?
I'm using the current released versions of everything.
Thanks in advance,
Jeff