The problem is I need to derive two tree's from a base-class
One must be of type subclass, the other from type joined-subclass
Before I had the subclass-classes also as joined-subclass and everything runned fine, but I needed to change plan.
Now I get the exception shown below with this mapping file. If I comment out the subclass, it runs fine. It looks to me that Hibernate can not handle subclass and joined-subclass in one mapping-tree, or am I wrong?
Anyone a suggesting what I can do. it cost me now more then six hours of experimenting.
Thanks in advance for any help
Bert
Hibernate version: 3.0.5
Mapping documents:
Code:
<hibernate-mapping>
<class name="org.openehr.rm.common.archetyped.Locatable" abstract="true" table="locatable">
<id type="long" column="_id" name="_id" unsaved-value="0">
<generator class="identity"/>
</id>
<many-to-one name="archetypeDetails" column="loc_archetype_details_id" cascade="all"/>
<property name="archetypeNodeId" column="loc_archetype_node_id_id" type="string"/>
<many-to-one name="feederAudit" column="loc_feeder_audit_id" cascade="all"/>
<set name="Links" lazy="false" cascade="all">
<key column="links_locatable_id"/>
<one-to-many class="org.openehr.rm.common.archetyped.Link"/>
</set>
<many-to-one name="name" column="loc_name_id" cascade="all"/>
<many-to-one name="parent" column="loc_parent_id" cascade="all"/>
<many-to-one name="uid" column="loc_uid_id" cascade="all"/>
<subclass name="org.openehr.rm.datastructure.itemstructure.representation.Item" discriminator-value="Item">
<many-to-one name="value" column="ele_value_id" cascade="all"/>
<many-to-one name="nullFlavor" column="ele_null_flavor_id" cascade="all"/>
</subclass>
<joined-subclass name="org.openehr.rm.composition.content.entry.Activity" table="activity">
<key column="activity_id"/>
<many-to-one name="description" column="act_description_id" cascade="all"/>
<many-to-one name="timing" column="act_timing_id" cascade="all"/>
</joined-subclass>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
[INFO] Could not read mapping document from file: r:\Projects\Vivici\Build\home\verhees\Zorggemak\ACode\sandbox\openehr-orm\target\classes\Locatable.hbm.xml
The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(
es|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(q
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.hibernate.MappingException: Could not read mapping document from file: r:\Projects\Vivici\Build\home\verhees\Zorggemak\ACode\sandbox\openehr-orm\target\classes\Locatabl
at org.hibernate.cfg.Configuration.addFile(Configuration.java:297)
at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:618)
at org.codehaus.mojo.hibernate3.configuration.AbstractConfigHibernate.getConfiguration(AbstractConfigHibernate.java:124)
at org.codehaus.mojo.hibernate3.configuration.jdk15.ConfigHibernateImpl.getConfiguration(ConfigHibernateImpl.java:44)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.getConfiguration(HibernateExporterMojo.java:109)
at org.codehaus.mojo.hibernate3.exporter.SchemaUpdateMojo.doSchemaUpdate(SchemaUpdateMojo.java:73)
at org.codehaus.mojo.hibernate3.exporter.SchemaUpdateMojo.doExecute(SchemaUpdateMojo.java:62)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:60)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:567)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:294)
... 25 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discrim
o-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:296)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1953)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:878)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1144)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:987)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1445)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:563)
... 26 more