-->
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: DTD error when adding version property
PostPosted: Mon Apr 24, 2006 1:07 pm 
Newbie

Joined: Wed Mar 01, 2006 9:42 am
Posts: 4
It must be a stupid mistake but I can't find it!

When I add the property "version" to my hbm file, the hbm is not valid against the dtd ?!

Code:
<version name="version" column="VERSION"/>

I get this message:
Code:
The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(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)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".


Please Help!


Hibernate version:Hibernate 3.1.2 and 3.1.3

Mapping documents:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<!-- dynamic-update="true" optimistic-lock="version" -->
   <class name="com.comp.test.dao.Person" table="PERSONS" >
      <id name="id" column="ID">
         <generator class="identity" />
      </id>
      <property name="firstname" column="FIRSTNAME" length="100"/>
      <property name="lastname" column="LASTNAME" length="100"/>
      <version name="version" column="VERSION"/>
   </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Code:
18:59:46,475 ERROR [XMLHelper] Error parsing XML: XML InputStream(14) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(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)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not read mappings from resource: com/comp/test/dao/Person.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
   at com.comp.util.HibernateUtil.<clinit>(HibernateUtil.java:16)
   at com.comp.test.dao.PersonneDAO.startUpdate(PersonneDAO.java:16)
   at com.comp.test.lock.optimiste.Main.main(Main.java:14)
Caused by: org.hibernate.MappingException: Could not read mappings from resource: com/comp/test/dao/Person.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
   at com.comp.util.HibernateUtil.<clinit>(HibernateUtil.java:12)
   ... 2 more
Caused by: org.hibernate.MappingException: invalid mapping
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:425)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
   ... 9 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(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)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
   at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.dom4j.io.SAXReader.read(SAXReader.java:465)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
   ... 10 more

[/code]

_________________
Benjamin Francisoud


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 1:09 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
move version above properties.


Top
 Profile  
 
 Post subject: That's it!
PostPosted: Tue Apr 25, 2006 7:07 am 
Newbie

Joined: Wed Mar 01, 2006 9:42 am
Posts: 4
abg1979 wrote:
move version above properties.

That's it! Thanks!

ps: It was stupid ;)

_________________
Benjamin Francisoud


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.