-->
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.  [ 4 posts ] 
Author Message
 Post subject: <version> and <timestamp> tags cause xml parsing
PostPosted: Thu Sep 01, 2005 5:10 pm 
Beginner
Beginner

Joined: Wed Jul 13, 2005 2:18 pm
Posts: 44
I'm baffled by this one. Using Hibernate 3.0.5, and wanting to add a <timestamp> tag to an existing mapping. My XML editor validates the document just fine based on the DTD, but I receive an exception during parsing.

Mapping file:
Code:
<?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="edu.taylor.domain.services.testscore">
   <class name="TestScore" table="SORTEST">
      <composite-id name="id" class="TestScoreKey">
         <key-property name="pidm" column="SORTEST_PIDM"/>
         <key-property name="dateTaken" column="SORTEST_TEST_DATE"/>
         <key-property name="code" column="SORTEST_TESC_CODE"/>
      </composite-id>
      <timestamp name="activityDate" column="SORTEST_ACTIVITY_DATE" unsaved-value="null"/>
      <discriminator
         formula="case when SORTEST_TESC_CODE like 'PX1%' then 'PX1T' else SORTEST_TESC_CODE end"/>
      <property name="score" column="SORTEST_TEST_SCORE"/>
      <many-to-one
         name="test"
         class="Test"
         column="SORTEST_TESC_CODE"
         insert="false"
         update="false"
         lazy="false"
         fetch="join"/>
   </class>
</hibernate-mapping>


Stack trace:
Code:
INFO http-8080-Processor25 org.hibernate.cfg.Configuration - Configuration resource: /hibernate-iapp.cfg.xml
INFO http-8080-Processor25 org.hibernate.cfg.Configuration - Mapping resource: edu/taylor/domain/StudentIAPP.hbm.xml
INFO http-8080-Processor25 org.hibernate.cfg.HbmBinder - Mapping class: edu.taylor.domain.Student -> Student
INFO http-8080-Processor25 org.hibernate.cfg.Configuration - Mapping resource: edu/taylor/domain/services/testscore/Test.hbm.xml
INFO http-8080-Processor25 org.hibernate.cfg.HbmBinder - Mapping class: edu.taylor.domain.services.testscore.Test -> STVTESC
INFO http-8080-Processor25 org.hibernate.cfg.Configuration - Mapping resource: edu/taylor/domain/services/testscore/TestScore.hbm.xml
ERROR http-8080-Processor25 org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(23) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".
ERROR http-8080-Processor25 edu.taylor.webapps.teachered.TeacherEdServlet - Couldn't create Banner hibernate session factory
ERROR http-8080-Processor25 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/tetracking] - StandardWrapper.Throwable
java.lang.RuntimeException: org.hibernate.MappingException: Error reading resource: edu/taylor/domain/services/testscore/TestScore.hbm.xml
   at edu.taylor.webapps.teachered.TeacherEdServlet.init(TeacherEdServlet.java:53)
   at javax.servlet.GenericServlet.init(GenericServlet.java:211)
   at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
   at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:750)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.MappingException: Error reading resource: edu/taylor/domain/services/testscore/TestScore.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
   at edu.taylor.webapps.teachered.TeacherEdServlet.init(TeacherEdServlet.java:50)
   ... 15 more
Caused by: org.hibernate.MappingException: invalid mapping
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:399)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
   ... 21 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
   at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
   at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
   at org.dom4j.io.SAXReader.read(SAXReader.java:465)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
   ... 22 more



You're allowed to make fun of me if you can point out my problem.

_________________
- Matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 5:12 pm 
Beginner
Beginner

Joined: Wed Jul 13, 2005 2:18 pm
Posts: 44
Good grief. The subject should end with the word 'exception'. I am illiterate.

_________________
- Matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 5:57 pm 
Beginner
Beginner

Joined: Wed Jul 13, 2005 2:18 pm
Posts: 44
Never mind. I didn't realize the order of tags under <class> was important. Problem solved.

_________________
- Matt


Top
 Profile  
 
 Post subject: The actual order.
PostPosted: Wed Jan 25, 2006 5:25 pm 
Newbie

Joined: Thu Jan 05, 2006 12:42 am
Posts: 3
FYI, we solved this by moving the 'discriminator' tag above the 'version' tag.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.