Hi, I'm trying to use SchemaExport and SchemaUpdate from an Ant script within Eclipse.
I have two problems related with classpath settings :
1) SchemaExport and SchemaUpdate both fail
2) I can't log anything
log4j.properties is in classes directory
the .java files are generated by hbm2java into src/hibgen directory
the lib directory contains all the *.jar files needed by hibernate (I'm currently using hibernate from a servlet without many problems except my lack of knowledge ;-)
So, no logging is enabled (log4j:WARN Please initialize the log4j system properly)
AND my main concern :
net.sf.hibernate.MappingException: persistent class [hibgen.Message] not found
I even use a Windows File Monitoring utility and can see that hibgen/Message.class is read successfully several times during and the build process.
I've tried the FAQ, the doc and to gather informations from this forum.
I really don't know what to do...
Could someone help me ?
Thanks
Hibernate version:
2.1
Mapping documents:
<hibernate-mapping package="hibgen">
<class name="Message" table="message">
<id name="id" type="long" column="id"><generator class="vm"/></id>
<property name="title" column="title" type="string" not-null="false" length="255" />
<property name="content" column="content" type="text" not-null="false"/>
<property name="datecreated" column="datecreated" type="date" not-null="false"/>
</class>
</hibernate-mapping>
Ant script
<project name="mytest" default="hib_exportddl" basedir=".">
<property name="src.dir" location="WEB-INF/src"/>
<property name="lib.dir" location="WEB-INF/lib"/>
<property name="bin.dir" location="WEB-INF/classes"/>
<path id="classpath">
<pathelement location="${src.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${bin.dir}">
<include name="**/*.class" />
<include name="**/log4j.properties" />
</fileset>
<fileset dir="${bin.dir}/hibgen">
<include name="**/*.class" />
</fileset>
</path>
<taskdef name="schemaupdate" classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask" classpathref="classpath"/>
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="classpath"/>
<target name="hib_exportddl">
<schemaupdate properties="WEB-INF/hibernate.properties" quiet="no">
<fileset dir="${bin.dir}">
<include name="**/*.hbm.xml" />
</fileset>
</schemaupdate>
</target>
</project>
|