Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.1
Hibernate tools version: 3.0.1.beta2
Full stack trace of any exception that occurs:
Buildfile: C:\EclipseWorkSpace\FirstHibernateProject\build.xml
clean:
[delete] Deleting directory C:\EclipseWorkSpace\FirstHibernateProject\bin
[mkdir] Created dir: C:\EclipseWorkSpace\FirstHibernateProject\bin
codegen:
Overriding previous definition of reference to eclipse.ant.targetVector
hibernate-codegen:
BUILD FAILED
C:\EclipseWorkSpace\FirstHibernateProject\build.xml:64: The following error occurred while executing this line:
C:\EclipseWorkSpace\FirstHibernateProject\hibernate-codegen.xml:8: Could not create type hbm2java due to java.lang.NoSuchMethodException: org.hibernate.tool.ant.Hbm2JavaGeneratorTask.<init>(org.apache.tools.ant.Project)
Total time: 891 milliseconds
My build.xml portion :
<taskdef name="hbm2java" classname="org.hibernate.tool.ant.Hbm2JavaGeneratorTask"
classpathref="project.class.path"/>
<target name="codegen"
description="Generate java source-files from hbm.xml mapping files">
<ant antfile="hibernate-codegen.xml"
dir="."
inheritAll="true"
inheritRefs="true">
<reference refid="project.class.path"
torefid="project.class.path"/>
</ant>
</target>
sub-build.xml file:
<target name="hibernate-codegen"
description="Generate java source-files from hbm.xml mapping files" >
<hbm2java output="${targetdir}">
<fileset dir="${sourcedir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
What I am trying to accomplish is generate the supporting files for a POJO that has a findAll method.
*.hbm.xml file:
<hibernate-mapping package="com.hibernate.test">
<class name="Honey" table="honey">
<meta attribute="session-method">
HibernateUtil.getSession();
</meta>
<id name="id" column="honeyId" type="java.lang.Integer">
<!-- postgre:
<generate class="sequence">
<param name="sequence">honey_id_seq</param>
</generate>
-->
<generator class="native"/>
</id>
<property name="name" column="honeyName" type="java.lang.String" />
<property name="taste" column="taste" type="java.lang.String" />
</class>
</hibernate-mapping>
I have attempted to follow the examples on how to go about this, but I have not been successful.
Any suggestions would be greatly appreciated.
Russ