0

I was trying hibernate 3 for practice. and i am having this error.

Exception in thread "main" org.hibernate.MappingException: Error reading resource: test/Reservation.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 org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at HibTestMain.main(HibTestMain.java:16)
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)
... 7 more
Caused by: org.xml.sax.SAXParseException: The content of element type "version"     must     match "(meta)*".
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:398)
... 8 more

here are my hbm file.

<hibernate-mapping package="org.azureworlds.dao">
 <class name="Reservation" table="reservation">
  <id name="id" type="integer">
   <column name="ID"/>
   <generator class="native"/>
  </id>
  <version  name="version" type="integer">
            <column name="VERSION" />
  </version>
  <property generated="never" lazy="false" name="creationTime" type="timestamp">
   <column length="0" name="CREATION_TIME" not-null="true"/>
  </property>
 </class>
</hibernate-mapping>

What am i doing wrong. It seems the problem is with version tag. I tried different thing but in vein.

The bean and hbm file is generated by MyEclipse Persistence Tools

More information will be provided if needed. Thanks in advance

Jafar Ali
  • 1,084
  • 3
  • 16
  • 39

1 Answers1

0

Change

<version  name="version" type="integer">
        <column name="VERSION" />

to

<version column="VERSION" name="version" type="integer" />
Todd Murray
  • 423
  • 2
  • 7