-->
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: Hibernate 3 hbm2java
PostPosted: Sat Oct 08, 2005 11:01 am 
Newbie

Joined: Fri Apr 16, 2004 9:27 am
Posts: 18
Location: Russia, Spb
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

I have a problem with code generation. hbm2java task doesn't work correctly.

I use the following definition in build.xml file

Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath"/>

    <target name="codegen">
        <hibernatetool destdir="${class.dir}">
            <configuration propertyfile="${props.dir}/hibernate.properties">
                <fileset dir="${hbm.dir}">
                    <include name="**/*.hbm.xml" />
                </fileset>
            </configuration>

            <hbm2java />
        </hibernatetool>
    </target>


As result of executing this task I have error message:

SEVERE: Could not configure datastore from file: <some-mapping-file.hbm.xml>
org.hibernate.MappingException: class <some-class> not found while looking for property: name


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 08, 2005 11:34 am 
Beginner
Beginner

Joined: Sat Oct 08, 2005 2:13 am
Posts: 47
Hi
plz show me that hbm.xml and the class that cause the exception


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 08, 2005 11:51 am 
Newbie

Joined: Fri Apr 16, 2004 9:27 am
Posts: 18
Location: Russia, Spb
mnrz wrote:
Hi
plz show me that hbm.xml and the class that cause the exception


I don't have class. I want generate it by hbm2java.

For example: mapping file for Album.

Code:
<?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="springdemo.dao.Album" table="ALBUM">

        <id name="id" type="long">
            <column name="ID" not-null="true"/>
            <generator class="native"/>
        </id>

        <property name="name" column="NAME" length="64" not-null="true" />
        <property name="releaseDate" column="RELEASE_DATE" type="date" not-null="true"/>

        <many-to-one name="artist" column="ARTIST_ID" class="Artist" not-null="true" />

        <set name="tracks">
            <key column="ALBUM_ID" not-null="true" />
            <one-to-many class="Track" />
        </set>

    </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 08, 2005 1:51 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
you have not specified a type for the name property. the generator is then trying to infer this information from the class itself, which is not in the classpath.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.