I am trying to port my hibernate application from Oracle to DB2.
I created a minimal hibernate.properties file (that contains the dialect specification), put all the necessary JAR files in the classpath and ran the tool on all the *.hbm.xml files.
Everything works fine until it tries to process an hbm file that has the following code (which is exactly as explained in section 8.2 in the Hibernate Reference manual):
Code:
<set name="workingItems"
lazy="true"
table="MA_COMMAND_WORKING_ITEM">
<key column="COMMAND_ID"/>
<composite-element class="com.acme.data.pojo.ManagementAuthorityCommandWorkingItem">
<property name="id" column="ID" not-null="true"/>
<property name="action" column="ACTION" not-null="true"/>
<property name="workingItemId" column="WORKING_ITEM_ID" not-null="true"/>
</composite-element>
</set>
I do NOT have the class listed in the <composite-element> as this is not needed and works fine with my code.
Here is the output from the tool:
Code:
SEVERE: Error creating schema
org.hibernate.MappingException: class com.acme.data.pojo.ManagementAuthorityCommandWorkingItem not found while looking for property: id
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:74)
at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2164)
at org.hibernate.cfg.HbmBinder.bindComponent(HbmBinder.java:1893)
at org.hibernate.cfg.HbmBinder.bindComposite(HbmBinder.java:1692)
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2448)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2652)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1054)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:687)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:93)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:394)
Caused by: java.lang.ClassNotFoundException: com.acme.data.pojo.ManagementAuthorityCommandWorkingItem
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:70)
... 12 more
[/code]
Any help, pointers, RTFM's are welcome.