-->
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: hbm2java - no java generated due to MappingExceptions
PostPosted: Thu Sep 08, 2005 12:53 pm 
Newbie

Joined: Thu Sep 08, 2005 12:37 pm
Posts: 10
Hello,

I just switched to Hibernate 3.0.5 and stick to some problems while generating POJOs from my Mapping Files. The Cargo.hbm.xml you find hereafter is valid but during the hbm2java generation a check against the (not yet generated and compiled Cargo.class) was performed by the HBMBinder. What is wrong? I can't generate any POJOs

Oliver-Arne

Hibernate version:3.0.5 / Tools 3.1 alpha 5

Mapping documents:
Code:
<hibernate-mapping package="de.oc.shipment.entities">
<class name="de.oc.shipment.entities.Cargo" table="CARGO" lazy="true">
   <meta attribute="class-description">
   Represents a single Cargo in the Cargo-Shipment System
   </meta>
      <comment></comment>
      
      <id name="id" column="CARGO_ID">
         <generator class="native"/>
      </id>
      
      <property name="length" type="double" not-null="true"></property>
      <property name="width" type="double" not-null="true"></property>
      <property name="heights" type="double" not-null="true"></property>
      <property name="weight" type="double" not-null="true"></property>
      <property name="security-constraint" type="string" not-null="false"></property>
      
      <many-to-one name="customer" column="CUSTOMER_ID" class="Customer" not-null="true"></many-to-one>
            
   </class>
</hibernate-mapping>


Excerpt from my build.xml:
Code:
<target name="generate.code">
      <hibernatetool destdir="${sourcedir}">
         <configuration>
            <fileset dir="${sourcedir}">
               <include name="**/*.hbm.xml" />
            </fileset>
         </configuration>
         
         <hbm2java generics="true">
         </hbm2java>
      </hibernatetool>
   </target>

Full stack trace of any exception that occurs:

Code:
generate.code:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 18:35:27,669  INFO Environment:464 - Hibernate 3.0.5
[hibernatetool] 18:35:27,679  INFO Environment:477 - hibernate.properties not found
[hibernatetool] 18:35:27,689  INFO Environment:510 - using CGLIB reflection optimizer
[hibernatetool] 18:35:27,689  INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 18:35:27,949  INFO Configuration:243 - Mapping file: C:\Dokumente und Einstellungen\oah\workspace\Cargo-Shipment\src\de\oc\shipment\entities\Cargo.hbm.xml
[hibernatetool] 18:35:28,039 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
[hibernatetool] 18:35:28,049 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
[hibernatetool] 18:35:28,480  INFO HbmBinder:260 - Mapping class: de.oc.shipment.entities.Cargo -> CARGO
[hibernatetool] 18:35:28,510 ERROR Configuration:365 - Could not compile the mapping document
[hibernatetool] org.hibernate.MappingException: class de.oc.shipment.entities.Cargo not found while looking for property: id
[hibernatetool] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[hibernatetool] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[hibernatetool] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[hibernatetool] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
[hibernatetool] at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:110)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:93)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:79)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:158)
[hibernatetool] at org.hibernate.tool.ant.GeneratorTask.configureExporter(GeneratorTask.java:73)
[hibernatetool] at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.configureExporter(Hbm2JavaGeneratorTask.java:37)
[hibernatetool] at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:31)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] Caused by: java.lang.ClassNotFoundException: de.oc.shipment.entities.Cargo
[hibernatetool] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[hibernatetool] at java.security.AccessController.doPrivileged(Native Method)
[hibernatetool] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[hibernatetool] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[hibernatetool] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[hibernatetool] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[hibernatetool] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[hibernatetool] at java.lang.Class.forName0(Native Method)
[hibernatetool] at java.lang.Class.forName(Class.java:164)
[hibernatetool] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hibernatetool] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[hibernatetool] ... 28 more
[hibernatetool] 18:35:28,600 ERROR Configuration:248 - Could not configure datastore from file: C:\Dokumente und Einstellungen\oah\workspace\Cargo-Shipment\src\de\oc\shipment\entities\Cargo.hbm.xml
[hibernatetool] org.hibernate.MappingException: class de.oc.shipment.entities.Cargo not found while looking for property: id
[hibernatetool] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[hibernatetool] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[hibernatetool] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[hibernatetool] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
[hibernatetool] at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:110)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:93)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:79)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:158)
[hibernatetool] at org.hibernate.tool.ant.GeneratorTask.configureExporter(GeneratorTask.java:73)
[hibernatetool] at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.configureExporter(Hbm2JavaGeneratorTask.java:37)
[hibernatetool] at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:31)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] Caused by: java.lang.ClassNotFoundException: de.oc.shipment.entities.Cargo
[hibernatetool] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[hibernatetool] at java.security.AccessController.doPrivileged(Native Method)
[hibernatetool] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[hibernatetool] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[hibernatetool] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[hibernatetool] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[hibernatetool] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[hibernatetool] at java.lang.Class.forName0(Native Method)
[hibernatetool] at java.lang.Class.forName(Class.java:164)
[hibernatetool] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hibernatetool] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[hibernatetool] ... 28 more

Name and version of the database you are using:
Oracle 10g Release 1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 1:53 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
@type has not been specified for the id property. That's OK, hibernate will then look for the .class and use reflection to determine this. The class however isn't in the classpath.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 2:05 pm 
Newbie

Joined: Thu Sep 08, 2005 12:37 pm
Posts: 10
Hello,

thanks!

Best regards
Oliver-Arne


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 3:46 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
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.  [ 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.