Hibernate を使用して、テスト用にデータベースを自動的に生成しています。スキーマには、インポートに非常に長い時間がかかる静的データを含むテーブルがいくつかあります。過去に、ビルド ファイルで次のコードを使用して、(マッピング ファイルから) データベースを生成しました。
<target name="schema-gen" depends="hibernate-gen">
<taskdef name="schemaexport" classname="org.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.classpath" />
<schemaexport properties="resources/hibernate.properties" text="false" quiet="false" delimiter=";" output="schema.sql">
<fileset dir="${build.doclets}">
<include name="**/*.hbm.xml" />
<exclude name="**/inert/*.hbm.xml" />
</fileset>
</schemaexport>
</target>
.hbm.xml ファイルは、XDoclet を使用して生成されました。マッピングに Hibernate Annotations を使用するように移行しているので、hibernatetools に移行してスキーマを生成します。
<target name="annotations-export" depends="hibernate-gen">
<hibernatetool destdir="${basedir}">
<annotationconfiguration configurationfile="${basedir}/resources/hibernate.cfg.xml" propertyfile="${basedir}/resources/hibernate.properties" />
<classpath>
<path refid="project.classpath" />
</classpath>
<hbm2ddl drop="true" create="true" export="true" outputfilename="schema.sql" delimiter=";" format="true" />
</hibernatetool>
</target>
schemaexport で使用していたのと同じように、hbm2ddl に「不活性」パッケージのクラスを除外するように指示できるようにしたいと考えています。そうする方法があるかどうか誰でも知っていますか?