We are currently using Hibernate 3 and we use Hibernate Tools to generate SQL scripts for the DB schema.
We use the following Ant task
<hibernatetool destdir="${target}">
<jpaconfiguration persistenceunit="@{persistenceUnit}" propertyfile="@{propertyfile}"/>
<classpath refid="@{classpathid}"/>
<!-- the file name is relative to $destdir -->
<hbm2ddl outputfilename="@{output}" format="true" export="false" drop="false"/>
</hibernatetool>
We would like to switch to Hibernate 4: how can we achieve something similar without Hibernate tools?
You can directly use the SchemaExport class to generate the DDL script :