-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Ant tasck for code generation
PostPosted: Thu Jul 06, 2006 2:54 am 
Newbie

Joined: Mon Feb 14, 2005 10:11 am
Posts: 10
Location: Italy
Good morning at all
I'm using Hibernate version: 3.1 and Hibernate tools version: 3.1 beta 5

I tried this script to generate Java model code from my *.hbm.xml mapping files:

<target name="create-code" depends="init">
<taskdef name="hbm2java" classname="org.hibernate.tool.ant.Hbm2JavaExporterTask">
<classpath>
<fileset dir="${lib.dir}" includes="*.jar" />
<pathelement location="${build.classes.dir}/" />
</classpath>
</taskdef>
<hbm2java output="${src.dir}">
<fileset dir="${src.dir}/etc/hibernate/" includes="**/*.hbm.xml" />
</hbm2java>
</target>

<target name="init">
<echo message="build.compiler = ${build.compiler}" />
<echo message="user.home = ${user.home}" />
<echo message="java.home = ${java.home}" />
<echo message="ant.home = ${ant.home}" />
<echo message="java.class.path = ${java.class.path}" />
<echo message="" />
<available classname="java.lang.StrictMath" property="jdk1.3+" />
</target>

but Ant throws this message :

Could not create type hbm2java due to java.lang.NoSuchMethodException: org.hibernate.tool.ant.Hbm2JavaExporterTask.<init>(org.apache.tools.ant.Project)

What's wrong in my script ?

_________________
Ing. Marco Rinaldi - Italy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 4:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
read the docs for Hibernate 3 tools ;)

(for lazy people you can also read migration guide at http://www.hibernate.org/385.html)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 8:10 am 
Newbie

Joined: Mon Feb 14, 2005 10:11 am
Posts: 10
Location: Italy
Thank you. I read the document an find a solution.

<target name="create-code">
<mkdir dir="${build.dir}/generated" />
<hibernatetool destdir="${build.dir}/generated">
<configuration configurationfile="${etc.dir}/hibernate/hibernate.cfg.xml">
</configuration>
<hbm2java jdk5="true" ejb3="false"/>
</hibernatetool>
</target>

Now I encounter another error:

java.lang.NoSuchMethodError: org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;

org.hibernate.tool.hbm2x.ExporterException: Error while processing template Pojo

What is that mean ? I've got the wrog library version ?

_________________
Ing. Marco Rinaldi - Italy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 10:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that you are not using the hibernate that is bundled with the tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.