-->
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.  [ 7 posts ] 
Author Message
 Post subject: hbm2java -> Error
PostPosted: Tue Feb 14, 2006 1:56 pm 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
I am new to the hibernate tools and am trying to use the ant tool hbm2java to generate the POJOs for me from my hibernate mapping file. I am getting the following error:

[hibernatetool] org.hibernate.MappingException: class robot.dao.pojo.Environment not found while looking for property: id

My mapping file is as follows:

Code:
<hibernate-mapping>
   <class  name="org.tiaa.robot.dao.pojo.Environment"
         table="DSV_ROBOT_ENV">

      <id name="id" column="ENV_ID">
         <generator class="native"/>
      </id>
      
      <property name="name" column="NAME"/>
      <property name="description" column="DESCRIPTION"/>
      <property name="sortOrder" column="SORT"/>
      
    </class>
      
</hibernate-mapping>


My Ant Task is as follows:

Code:
<target name="local.hibernate">
      <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
         <classpath>
            <fileset dir="${buildlib.dir}">
               <include name="hibernate-tools.jar"/>
               <include name="velocity-1.4.jar"/>
               <include name="velocity-tools-generic-1.1.jar"/>
               <include name="jtidy-r8-21122004.jar"/>
            </fileset>
            <fileset dir="${lib.dir}">
               <include name="hibernate3.jar"/>
               <include name="asm-attrs.jar"/>
               <include name="asm.jar"/>
               <include name="cglib-2.1.jar"/>
               <include name="dom4j-1.6.jar"/>
               <include name="ehcache-1.1.jar"/>
               <include name="commons-collections.jar"/>
            </fileset>
         </classpath>
      </taskdef>

      <echo message="local.hibernate"/>
      <mkdir dir="${src.dir}/java/robot/dao/pojo"/>
      <delete>
         <fileset dir="${src.dir}/java/robot/dao/pojo">
            <include name="**/*.java"/>
         </fileset>
      </delete>

      <hibernatetool   destdir="${src.dir}/java">
         <configuration>
            <fileset dir="${docroot.dir}/WEB-INF/classes">
                <include name="**/*.hbm.xml"/>
            </fileset>             
         </configuration>
         <hbm2java jdk5="false" ejb3="false"/>
      </hibernatetool>
   </target>

Any help would be greatly appreciated.

Thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 2:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
setting the type for id would make it possible for hbm2java to deduce the type without having to load the class ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: That got me to the next error...
PostPosted: Tue Feb 14, 2006 3:07 pm 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
Thank you! That got me past that error and now to a new one. Sorry to be a pest but any idea on this one:

BUILD FAILED
C:\projects\DSVRobot\implementation\build_config\build.xml:50: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method 'get' in class org.hibernate.tool.hbm2x.TemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoEqualsHashcode.vm. Invocation of method 'needsEqualsHashCode' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.isNaturalIdentifier()Z


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use the hibernate.jar that comes with the tools....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Thank you!!!
PostPosted: Wed Feb 15, 2006 12:22 pm 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
That did the trick. Thank you for the assistance. Now on to understanding mappings and getting a better handle on what appears to be a very powerful tool.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 5:29 am 
Newbie

Joined: Wed May 14, 2008 5:25 am
Posts: 1
max wrote:
setting the type for id would make it possible for hbm2java to deduce the type without having to load the class ;)


Oh, oh

is this somewhere documented? I almost gave up code generation because I didn't specify the type, so I got always errors. (Ok, it's obvious, but for dummies like me, it would be helpful to see a big warning in the ToolsDoc)

thanx


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 7:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Feel free to contribute a patch/suggestion on how/where we should document it.....not specifying types and expect codegeneration is for me kinda obvious that it will fail ;)

_________________
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.  [ 7 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.