Тестовый проект hibernate не работает

Я пробовал Hibernate 3 для практики. и у меня эта ошибка.

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

вот мой файл hbm.

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

Что я делаю неправильно. Кажется, проблема в теге версии. Я пробовал разные вещи, но в духе.

Файл bean и hbm генерируется MyEclipse Persistence Tools

Более подробная информация будет предоставлена ​​в случае необходимости. заранее спасибо

1 ответ

+ Изменить

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

в

<version column="VERSION" name="version" type="integer" />
Другие вопросы по тегам