Hello All,
I've recently removed hibernate.properties in favor of the XML config file so I don't have to programmatically add my *.hbm.xml files when configuring. Apparently the schemaexport Ant task can also use this file at build time, which is desirable.
However, it refuses to find any of my mapping files, even though they are listed (config file attached below).
How does schemaexport know where to find the files listed in the XML config file? The task takes no base directory, and adding the nested fileset seems to make no difference. The directory containing the mapping files is passed to the schemaexport taskdef as part of its classpath. I'm a little stumped here. The task finds none of my mapping files, which are indeed there.
Hibernate version:
2.1.6
Full stack trace of any exception that occurs:
Schema text failed: Error reading resource: com/expn/vo/AddressVO.hbm.xml
XML Config File
Code:
<hibernate-configuration>
<!-- SessionFactory (can't bind to JNDI in Tomcat, so element has no 'name' attribute -->
<session-factory>
<!-- properties -->
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="connection.provider_class">com.expn.database.ExpConnectionProvider</property>
<property name="show_sql">false</property>
<property name="default_schema">expnew</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<!-- mapping files -->
<mapping resource="com/expn/vo/UserVO.hbm.xml"/>
<mapping resource="com/expn/vo/UserRequestVO.hbm.xml"/>
<mapping resource="com/expn/vo/ContactVO.hbm.xml"/>
<mapping resource="com/expn/vo/AddressVO.hbm.xml"/>
<mapping resource="com/expn/vo/ProductVO.hbm.xml"/>
<mapping resource="com/expn/vo/AddressVO.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Ant 1.5.4 build file snippetsCode:
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<path refid="classpath" />
<pathelement location="${build.target}" />
</classpath>
</taskdef>
<target name="gen-sql" description="Generates the database schema from HBM files">
<schemaexport config="props/conf/hibernate.cfg.xml" quiet="no" text="yes" drop="no" delimiter=";" output="schema.sql">
<fileset dir="${build.target}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>