I'm using Hibernate 3.2.0 and HSQLDB. I have a lot (>50) of classes that need persisting, and there is quite some inheritance involved. The classes reside in many different packages, and I think that the packages are part of the problem.
The exception trace I get on when Hibernate loads its configuration is the following:
Quote:
org.hibernate.MappingException: Following superclasses referenced in extends not found: null,null,null,null (trimmed a bunch of nulls)
at org.hibernate.cfg.Configuration.processExtendsQueue(Configuration.java:1127)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1046)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at paragon.data.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:16)
When I add the package="my.pack.path" attribute for each mapping file to the hibernate-mapping tag, the various nulls in the error descriptors are prefixed with various package paths like null[my.pack.path]. Each mapping file corresponds to exactly one class. I have mapping files for my abstract classes (with abstract="true") and for my leaf classes. I tried with both union-subclass and join-subclass, it has no effect on the error. I use fully qualified names when referring to classes.
Here's a trimmed example of a mapping file for an abstract class:
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="paragon.data.universe.government">
<joined-subclass abstract="true" extends="paragon.data.universe.government.Government" name="paragon.data.universe.government.ParliamentaryGovernment" table="ParliamentaryGovernment">
<key column="id_"/>
<many-to-one class="paragon.data.universe.government.legislative.Parliament" name="parliament_"/>
</joined-subclass>
</hibernate-mapping>
And for a concrete class:
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="paragon.data.universe.government">
<joined-subclass extends="paragon.data.universe.government.ParliamentaryGovernment" name="paragon.data.universe.government.Nation" table="Nation">
<key column="id_"/>
<many-to-one class="paragon.data.universe.economy.Currency" name="currency_"/>
</joined-subclass>
</hibernate-mapping>
I've googled for this exception, but all I find are references to the source code of the Configuration class. I've examined the source code but couldn't get any wiser. Just to be sure, I've ordered my mapping files in my configuration file so that superclasses always precede subclasses.