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: Can't get Ant to use the code generation tool
PostPosted: Mon Jun 27, 2005 4:22 pm 
Beginner
Beginner

Joined: Thu Jun 23, 2005 11:23 am
Posts: 36
Location: Lancashire, England
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Name and version of the database you are using: hsqldb_1_7_3_3

Hallo -- I'm really sorry if this is a dumb question, but I promise I've been looking all over for answers & I'm drawing a blank.
I'm trying to get the 2nd chapter example from Hibernate: A Developer's Notebook to work with H3.0 and the v3 tools -- I've been trying to use the hbm2java functionality, but it won't work. I've opened up the jar file and made changes to the pathnames in the Ant build file, and have been grandually working my way through a number of errors, but am really stuck on this one. The error I get is this:

Code:
Buildfile: C:\Documents and Settings\DougLivesey\workspace\ch02\build.xml
codegen:

BUILD FAILED
C:\Documents and Settings\DougLivesey\workspace\ch02\build.xml:46: Could not create type hbm2java due to java.lang.NoSuchMethodException: org.hibernate.tool.ant.Hbm2JavaGeneratorTask.<init>(org.apache.tools.ant.Project)

Total time: 1 second


My build file currently looks like this:

Code:
<?xml version="1.0"?>
<project name="Harnessing Hibernate: The Developer's Notebook" default="db" basedir=".">
   <!-- Set up properties containing important project directories -->
   <property name="source.root" value="src" />
   <property name="class.root" value="bin" />
   <property name="lib.dir" value="lib" />
   <property name="data.dir" value="data" />
   
   <!-- Set up the classpath for compilation and execution -->
   <path id="project.class.path">
      <!-- Include our own classes -->
      <pathelement location="${class.root}" />
      <!-- Include jars in the project library directory -->
      <fileset dir="${lib.dir}">
         <include name="**/*.jar" />
      </fileset>
   </path>
   
   <target name="db" description="Runs HSQLDB UI against the database file -- use when app is not running">
      <java classname="org.hsqldb.util.DatabaseManager" fork="yes">
         <classpath refid="project.class.path" />
         <arg value="-driver" />
         <arg value="org.hsqldb.jdbcDriver" />
         <arg value="-url" />
         <arg value="jdbc:hsqldb:${data.dir}/music" />
         <arg value="-user" />
         <arg value="sa" />
      </java>
   </target>
   
   <!-- Teach Ant how to use Hibernate's code generation tool -->
   <taskdef name="hbm2java"
         classname="org.hibernate.tool.ant.Hbm2JavaGeneratorTask"
           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>
</project>


If there's any info anyone can point me to on getting this stuff to work, or any advice anyone can give, I'd be VERY grateful.
& if this is a dumb/previously documented question, I promise it's down to me being dumb, and not lazy!
Thanks for any & all advice,
doug.

_________________
Common sense is what tells you the world is flat.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 27, 2005 4:39 pm 
Beginner
Beginner

Joined: Thu Mar 31, 2005 5:59 pm
Posts: 34
I could never get it to work either, but writing Java POJOs and .hbm.xml mapping files really isn't too difficult. I'd recommend just doing it by hand instead... Maybe someone with more experience can help!

Susan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 7:26 am 
Beginner
Beginner

Joined: Thu Jun 23, 2005 11:23 am
Posts: 36
Location: Lancashire, England
Cheers for the reply -- friendliest thing I heard all day, & always nice to know you're not the only one having a problem!
If I find anything out, I'll let you know!
(Right now all I've learned is that trying to figure this out has a steep stress curve!)
Cheers again,
doug

_________________
Common sense is what tells you the world is flat.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 1:18 pm 
Beginner
Beginner

Joined: Thu Jun 23, 2005 11:23 am
Posts: 36
Location: Lancashire, England
Bingo!
Got the code & schema generation working w/ alot of help from one of the developers (Max)!
It's a long story, & it's told in the tools forum here:
http://forum.hibernate.org/viewtopic.php?t=944380

If you ever fancy trying the tools again, it may help -- it ends with the (currently working) build.xml file, and adapts examples from the book Hibernate A Developer's Notebook, chapters 1 & 2.
Man!
doug.

_________________
Common sense is what tells you the world is flat.


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.