I have been trying to convert my POJO's from single column primary keys (which compiles fine with hbm2java) to composite keys. Now when I try and create the POJO from the mapping I get a ClassDefNotFoundException.
The name of the hbm file and the POJO are different (I did this because I was getting exceptions due to different packages, and it worked fine with single column PK's).
NOTE: I cannot generate my own ID as I am working with a database that I have no admin privileges over.
I'm trying to duplicate the style of the 24.4.2 example in the Hibernate documentation.
Hibernate version: 3.0.5, HibernateTools alpha4
[b]Mapping documents:
CurrRipaEtgMpcDAOImpl.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/HibernateMapping DTD3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.excellus.arthr.model.op.CurrRipaEtgMpc" table="RIPARPT.T_ETGMPC">
<meta attribute="implement-equals">true</meta>
<meta attribute="implement-></meta>
<meta attribute="class-description">
Represents the T_ETGMPC table in the database.
@author ssayer
@version 1.0
</meta>
<composite-id name="id"
class="com.excellus.arthr.model.op.CurrRipaEtgMpc">
<key-property name="mpcno"/>
<key-property name="specialty"/>
</composite-id>
<property name="mpcno" type="string"/>
<property name="specialty" type="string"/>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
[hbm2java] org.hibernate.MappingException: Could not configure datastore from file: C:\Documents and Settings\ssayer\My Documents\IBM\wsappdevie51\workspace\arthr-model-op-hibernate\com\excellus\arthr\model\op\hibernate\CurrRipaEtgMpcDAOImpl.hbm.xml
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:124)
[hbm2java] at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
[hbm2java] at org.hibernate.tool.hbm2java.CodeGenerator.parseFiles(CodeGenerator.java:110)
[hbm2java] at org.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:95)
[hbm2java] at org.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
[hbm2java] at org.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
[hbm2java] at org.apache.tools.ant.Task.perform(Task.java:341)
[hbm2java] at org.apache.tools.ant.Target.execute(Target.java:309)
[hbm2java] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[hbm2java] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[hbm2java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:571)
[hbm2java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:367)
[hbm2java] at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:199)
[hbm2java] at java.lang.reflect.Method.invoke(Method.java)
[hbm2java] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:335)
[hbm2java] at org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:172)
[hbm2java] at java.lang.Thread.run(Thread.java:795)
[hbm2java] Caused by: org.hibernate.MappingException: class com.excellus.arthr.model.op.CurrRipaEtgMpc not found while looking for property: mpcno
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:124)
[hbm2java] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[hbm2java] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[hbm2java] at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:1841)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindComponent(HbmBinder.java:1602)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindCompositeId(HbmBinder.java:1490)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindCompositeId(HbmBinder.java:383)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:298)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[hbm2java] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[hbm2java] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[hbm2java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
[hbm2java] at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
[hbm2java] ... 15 more
[hbm2java] Caused by: java.lang.ClassNotFoundException: com.excellus.arthr.model.op.CurrRipaEtgMpc
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.Throwable.<init>(Throwable.java)
[hbm2java] at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java)
[hbm2java] at java.lang.Class.forNameImpl(Native Method)
[hbm2java] at java.lang.Class.forName(Class.java)
[hbm2java] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hbm2java] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[hbm2java] ... 26 more
|