-->
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.  [ 1 post ] 
Author Message
 Post subject: hbm2java does not create specified class for composite-id
PostPosted: Wed Sep 14, 2011 9:38 am 
Newbie

Joined: Wed Sep 14, 2011 8:55 am
Posts: 2
I have the specified the following composite-id element in one of my Hibernate configuration files:

Code:
    <composite-id name="id" class="com.foo.BarId">
        <key-many-to-one name="xxxId" class="Xxx" column="xxx_id"/>
        <key-many-to-one name="yyyId" class="Yyy" column="yyy_id"/>
    </composite-id>


When I run the "hbm2java" tool via an Ant build.xml file, the "com.foo.BarId" class file is not being generated automatically.

I assume that the "com.foo.BarId" class file should be created by the Hibernate tool (though I get by by creating it manually).

Can anyone please tell me what I might be doing wrong?

The "hbm2java" tool otherwise appears to work successfully: I have several configuration files (without composite IDs) and they are all generated as expected.

I am using Hibernate tools version 3.2.4.GA and Hibernate version 3.2.5.ga.

My ant build.xml file is set with following entries that enable the use of the Hibernate Tools via Maven:

Code:
    <path id="maven-ant-tasks.classpath" location="libraries/maven-ant-tasks-2.0.9.jar"/>
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
             uri="urn:maven-artifact-ant"
             classpathref="maven-ant-tasks.classpath">
    </typedef>
   
    <artifact:pom file="pom.xml" id="maven.pom" />
    <artifact:dependencies pathId="dependency.classpath">
        <pom refid="maven.pom"/>
    </artifact:dependencies>


And the Hibernate Tools task is defined in the prescribed way, as follows:

Code:
    <target name="initialise-hibernatetool" description="Initialise Hibernate Tools task">
        <taskdef name="hibernatetool"
                      classname="org.hibernate.tool.ant.HibernateToolTask"
                      classpathref="dependency.classpath"/>
    </target>


The "hbm2java" tool is then called as follows:

Code:
    <target name="hibernate-generate-java-classes" depends="initialise-hibernatetool">
        <hibernatetool destdir="src">
            <configuration configurationfile="hibernate/hibernate.cfg.xml"/>
            <classpath>
                <path location="hibernate"/>
            </classpath>
            <hbm2java/>
        </hibernatetool>
    </target>


TIA

Harry Mantheakis
London, UK


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.