-->
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.  [ 3 posts ] 
Author Message
 Post subject: 2.0 to 3.0 where is Hbm2JavaTask
PostPosted: Thu Mar 09, 2006 3:01 pm 
Beginner
Beginner

Joined: Thu Dec 15, 2005 12:02 pm
Posts: 23
I upgraded to 3.x from 2.x Hibernate. Now of course, I cannot find any of my old tools. I was using the Hbm2JavaTask (see below), and need a replacement for 3.x.

I have spend a fricken lot of time looking through the docs, only to become more confused than when I started.

Anyway, if someone could assist me getting this tool to run, I would appreciate it.


<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="project.class.path"/>

<!-- Generate the java code for all mapping files in our source tree -->
<target name="codegen"
description="Generate Java source from the O/R mapping files">
<hbm2java output="${source.root}">
<fileset dir="${source.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>



So much documentation ... so little organization.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 09, 2006 6:17 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
I did the following on a cygwin shell

cd hib3toolsdir

for f in `find . -name \*.jar -print`; do
jar -tvf $f | grep -i hbm2java && echo found in $f
done

Then it noted that this jar file contained something similar:
./plugins/org.hibernate.eclipse_3.1.0.beta/lib/tools/hibernate-tools.jar

The class was called:
org.hibernate.tool.ant.Hbm2JavaGeneratorTask.class


It appears that all the tools are now packaged for specify IDE's or "ant"..etc. instead of just being generally available; and I totally agree
that setup is frustrating at best..., since it is not document very well at all.
In the past, I did something similar to the above "find" - but first I search for all the *.jar files in the tools set, and copied them to my own "tools" dir, then ran the find (above) to locate the correct (or expected by guess) classes to use.

Hope this helps...

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 5:14 pm 
Newbie

Joined: Tue Jun 07, 2005 10:45 pm
Posts: 15
Location: Sydney
Here's out ant task which runs fine from Eclipse under Hibernate 3.1.2

Code:
<target name="hbm2java" description="Generate .java from .hbm files.">
  <delete>
    <fileset dir="${hibernateDO.dir}">
      <include name="**/*.java"/>            
    </fileset>         
  </delete>
      
  <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
    <classpath refid="classpath.common"/>
  </taskdef>
      
  <hibernatetool destdir="${src.dir}">
    <configuration>
      <fileset dir="${src.dir}">
        <include name="**/hbm/*.hbm.xml"/>
      </fileset>
    </configuration>
    <hbm2java generics="false"/>
  </hibernatetool>

</target>


Don't forget to rate if this helps :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.