-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SAXParseException: The content of element type "class&q
PostPosted: Tue Jun 05, 2007 6:03 pm 
Newbie

Joined: Tue Jun 05, 2007 5:48 pm
Posts: 3
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 12:36 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

You can't have both <subclass > and <joined-subclass > elements in one class element. it is restricted in http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd.


Amila

(Don't forget to rate if helps)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 4:50 am 
Newbie

Joined: Tue Jun 05, 2007 5:48 pm
Posts: 3
I have difficulties reading DTD's, but you pointed me in the right direction. I even did find a solution. it is possible to mix subclass and joined class, but the use of two hbm-files is then necessary. I describe it here for others, for information, like below

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"/>


     
      <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>


-------------------------------
<hibernate-mapping>
<subclass name="org.openehr.rm.datastructure.itemstructure.representation.Item"
extends="org.openehr.rm.common.archetyped.Locatable"
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>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.