Hi all,
I've a problem with using Hibernate 3 (with annotations) and the Hibernate ant task (from hibernate.tools.jar).
My ant task looks like that (snippet):
Code:
<!-- Define paths -->
<path id="class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="hbn.path">
<path refid="class.path"/>
<fileset dir="${classes.dir}" />
</path>
<target name="hibernate" description="Generates the hibernate files.">
<hibernatetool destdir="${basedir}" classpath="hbn.path">
<annotationconfiguration configurationfile="${gen-src.dir}/hibernate.cfg.xml"/>
<!-- SchemaExport based on Annotations -->
<hbm2ddl drop="false" outputfilename="ddl/evalon_ddl.sql" />
</hibernatetool>
</target>
Mapping documents:Code:
<hibernate-configuration>
<session-factory>
<!-- hibernate properties -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/hbn2oaw</property>
<property name="hibernate.connection.username">webshop_user</property>
<property name="hibernate.connection.password">webshop_user</property>
<property name="hibernate.connection.pool_size">5</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="use_outer_join">false</property>
<!-- mapping -->
<mapping class="net.sf.evalon.entity.Person" />
</session-factory>
</hibernate-configuration>
Ant output (on Eclipse console):Code:
Buildfile: E:\Fachhochschule\Projektarbeit\EvalOn\build.xml
Overriding previous definition of reference to class.path
hibernate:
[hibernatetool] Executing org.hibernate.tool.ant.Hbm2DDLGeneratorTask@1eb2c1b
[hibernatetool] 27.07.2005 17:54:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.0.3
[hibernatetool] 27.07.2005 17:54:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 27.07.2005 17:54:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using CGLIB reflection optimizer
[hibernatetool] 27.07.2005 17:54:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 27.07.2005 17:54:19 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
BUILD FAILED
E:\Fachhochschule\Projektarbeit\EvalOn\build.xml:103: org.hibernate.MappingException: Unable to load class declared as <mapping class="net.sf.evalon.entity.Person"/> in the configuration:
After trying for some hours I'm still not able to find out what I did wrong?
I just followed the instructions from the documentation...
(
http://www.hibernate.org/hib_docs/tools/ant/index.html)
Greets,
Christian
(still hoping that someone is able to help him :)!)