-->
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: java.lang.ClassCastException from hbm2java
PostPosted: Thu Nov 11, 2004 4:02 pm 
Newbie

Joined: Wed Oct 06, 2004 4:39 pm
Posts: 2
Location: Canada
I am getting a class cast exception running hbm2java on a simple mapping generated using middlegen. I am not sure what this exception indicates has happened. Thank you for your time.
Joel Hillacre
Hibernate version:
hibernate-2.1.6
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="com.tsiware.beans.Testtable"
    table="TESTTABLE"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="TESTTABLE"
    </meta>

    <id
        name="testcolumn1"
        type="java.lang.Long"
        column="TESTCOLUMN1"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
            type="java.lang.Long"
            column="TESTCOLUMN1"

        </meta>
        <generator class="assigned" />
    </id>

    <property
        name="testcolumn2"
        type="java.lang.Byte"
        column="TESTCOLUMN2"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="TESTCOLUMN2"
            length="4"
        </meta>   
    </property>
    <property
        name="testcolumn3"
        type="java.lang.Short"
        column="TESTCOLUMN3"
        length="6"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="TESTCOLUMN3"
            length="6"
        </meta>   
    </property>
    <property
        name="testcolumn4"
        type="java.lang.String"
        column="TESTCOLUMN4"
        length="255"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="TESTCOLUMN4"
            length="255"
        </meta>   
    </property>

    <!-- Associations -->
 

</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:
runhbm2java:
[hbm2java] Processing 1 files.
[hbm2java] Building hibernate objects
[hbm2java] java.lang.ClassCastException
[hbm2java] at net.sf.hibernate.tool.hbm2java.MetaAttributeHelper.mergeMetaMaps(MetaAttributeHelper.java:89)
[hbm2java] at net.sf.hibernate.tool.hbm2java.MetaAttributeHelper.loadAndMergeMetaMap(MetaAttributeHelper.java:110)
[hbm2java] at net.sf.hibernate.tool.hbm2java.ClassMapping.initWith(ClassMapping.java:160)
[hbm2java] at net.sf.hibernate.tool.hbm2java.ClassMapping.<init>(ClassMapping.java:72)
[hbm2java] at net.sf.hibernate.tool.hbm2java.CodeGenerator.handleClass(CodeGenerator.java:128)
[hbm2java] at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:103)
[hbm2java] at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
[hbm2java] at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
[hbm2java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hbm2java] at org.apache.tools.ant.Task.perform(Task.java:364)
[hbm2java] at org.apache.tools.ant.Target.execute(Target.java:341)
[hbm2java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hbm2java] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hbm2java] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hbm2java] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[hbm2java] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[hbm2java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[hbm2java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Build.xml:
Code:
      <mkdir dir="${gensrc.dir}/${package.dir}/beans"/>
      <taskdef
         name="hbm2java"
         classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
         classpathref="lib.class.path"
      />
      <hbm2java output="${gensrc.dir}">
         <fileset dir="${gensrc.dir}">
            <include name="**/*.hbm.xml"/>
         </fileset>
      </hbm2java>

Name and version of the database you are using:
MySQL 4.1.7-max


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 11, 2004 4:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if i remember correctly there was an issue with classcast when upgrading commons-collections. This should be fixed now.

Which version of hibernateext are you using ?
If its the latest release then please try the cvs version.

_________________
Max
Don't forget to rate


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