]
Steve Ebersole closed HHH-1175.
-------------------------------
Closing stale resolved issues
Exception when loading inheritance mapping in single file
---------------------------------------------------------
Key: HHH-1175
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1175
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.1 rc3
Reporter: Barthel Steckemetz
Assignee: Steve Ebersole
Priority: Minor
Fix For: 3.2.0.cr2
Attachments: HbmBinder.patch, single.zip, split.zip
We are trying to mix inheritance strategies.
We already have difficulties loading the mappings
at configuration time.
If we specify all mappings in a single mapping file (attached single.zip)
we get the following error:
org.hibernate.MappingException: Could not read mappings from resource:
com/ifbag/okular/base/hibernate/tst/HibBase.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:483)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1421)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1389)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1370)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1346)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1281)
at de.ifbfag.base.db.HConfiguration.configure(HConfiguration.java:53)
at de.ifbfag.base.db.HConfiguration.configureDBManager(HConfiguration.java:130)
at com.ifbag.okular.base.hibernate.tst.HibTestInit.init(HibTestInit.java:41)
at com.ifbag.okular.base.hibernate.tst.HibCrk.main(HibCrk.java:42)
Caused by: org.hibernate.MappingException: Cannot extend unmapped class
com.ifbag.okular.base.hibernate.tst.HibSub
at org.hibernate.cfg.HbmBinder.getSuperclass(HbmBinder.java:2772)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:116)
at org.hibernate.cfg.Configuration.add(Configuration.java:384)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:425)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:480)
... 9 more
When we split up the mapping file into two (split.zip) everything works.
The problem is in HbmBinder bindRoot:
Iterator subclassnodes = hmNode.elementIterator( "subclass" );
while ( subclassnodes.hasNext() ) {
Element subnode = (Element) subclassnodes.next();
PersistentClass superModel = getSuperclass( mappings, subnode );
handleSubclass( superModel, mappings, subnode, inheritedMetas );
}
Iterator joinedsubclassnodes = hmNode.elementIterator( "joined-subclass" );
while ( joinedsubclassnodes.hasNext() ) {
Element subnode = (Element) joinedsubclassnodes.next();
PersistentClass superModel = getSuperclass( mappings, subnode );
handleJoinedSubclass( superModel, mappings, subnode, inheritedMetas );
}
The example class HibSubSub can not be loaded in hmNode.elementIterator(
"subclass" ),
since it depends on HibSub which is not yet loaded in hmNode.elementIterator(
"joined-subclass" );
I do not know if there is a simple solution.
Seems to be a general problem when mappings referentiate each other.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: