Hi there,
First of all, I'm new to Hibernate. I read this
documentation and tried to generate some pojos from an existing mysql database via reverse engineering and apache ant. Here is my approach:
build.xml:
Code:
<project name="HibernateTest" basedir="." default="gen_hibernate">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</taskdef>
<target name="gen_hibernate" description="generate hibernate classes">
<hibernatetool>
<jdbcconfiguration configurationfile="hibernate.cfg.xml" packagename="my.package"/>
<hbm2hbmxml destdir="src" />
<hbm2java destdir="src" />
</hibernatetool>
</target>
</project>
hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.password">mypass</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.01/database</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>
</hibernate-configuration>
When I'm executing build.xml, the following error occurs:
Quote:
java.lang.IncompatibleClassChangeError: Found interface org.hibernate.cfg.Mappings, but class was expected
What went wrong?
Thanks in advance!