-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with Hibernate
PostPosted: Tue Mar 14, 2006 2:23 am 
Newbie

Joined: Fri Mar 10, 2006 12:30 pm
Posts: 1
Hello :
this is the build.xml in Ant:
<?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 ="classes"/>
<property name ="lib.dir" value="lib"/>
<property name="data.dir" value="data"/>
<!--Set up the class path for compilation and execution-->
<path id="project.class.path">
<!-- Include our own classes ,of course -->
<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 database management UI against

the database file -- use when application 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="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>
</project>


and this is track.hbm.xml:
<?xml version ="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.oreilly.hh.Track" table="TRACK">

<meta attribute = "class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from hibernate)
</meta>
<id name="id" type ="int" column="TRACK_ID">

<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>

<property name="title" type="string" not-null="true"/>
<property name="filepath" type="string" not-null="true"/>
<property name="playTime" type="time">
<meta attribute="field-description">Plying time</meta>
</property>

<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>
<property name="volume" type="short">
<meta attribute"field-description">How loud to play the track</meta>
</property>

</class>
</hibernate-mapping>

ok when I type the following command on the prompt:
ant codegen

it send me back this error:Build failed E:\HibernateProjects\ch01\build.xml:60: taskdef class net.sf.hibernate.tool.hbm2 java.HBM2JavaTask cannot be found.
I should mention I use hibernate-3.1.2 version.
Thank you very much for your attention please help me


Top
 Profile  
 
 Post subject: wrong tool classname
PostPosted: Tue Mar 14, 2006 12:49 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
you said you're using 3.1.2, but that looks like the old toolset specs. The v3 tools use
<taskdef ... classname="org.hibernate.tool.ant.HibernateToolTask" ...>
See
http://www.hibernate.org/hib_docs/tools ... tml#d0e651
for an example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.