-->
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.  [ 1 post ] 
Author Message
 Post subject: SAXParseException, why?
PostPosted: Fri Mar 11, 2005 8:15 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 12:02 pm
Posts: 39
Im using Xdoclet to generate the mapping and config files. I seem to get exceptions relating to :
Code:
select-before-update="false"
optimistic-lock="version"
access="property"


According to the DTD(I compared my mapping to the DTD manually) my mapping file is correct, why am I getting these exceptions?


Hibernate version: 2.0

Code:
<?xml version="1.0" encoding="UTF-8"?>

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

<hibernate-mapping
>
    <class
        name="hbn.Customer"
        table="customers"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <id
            name="id"
            column="id"
            type="long"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="name"
        />

        <set
            name="orders"
            lazy="false"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="customer_id"
              >
              </key>

              <one-to-many
                  class="hbn.Order"
              />

        </set>
    </class>

</hibernate-mapping>




Code:
C:\Eclipse\workspace\Project_00232\hibernate.cfg.xml
(cfg.Environment                     378 ) Hibernate 2.0 final
(cfg.Environment                     407 ) hibernate.properties not found
(cfg.Environment                     427 ) using CGLIB reflection optimizer
(cfg.Environment                     437 ) JVM proxy support: true
(cfg.Configuration                   270 ) Mapping resource: hbn/Order.hbm.xml
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(16)
org.xml.sax.SAXParseException: Attribute "select-before-update" must be declared for element type "class".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(16)
org.xml.sax.SAXParseException: Attribute "optimistic-lock" must be declared for element type "class".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(40)
org.xml.sax.SAXParseException: Attribute "access" must be declared for element type "property".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(mapping.Collection                  174 ) Mapping class: hbn.Order -> orders
(cfg.Configuration                   270 ) Mapping resource: hbn/Customer.hbm.xml
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(16)
org.xml.sax.SAXParseException: Attribute "select-before-update" must be declared for element type "class".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(16)
org.xml.sax.SAXParseException: Attribute "optimistic-lock" must be declared for element type "class".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(39)
org.xml.sax.SAXParseException: Attribute "access" must be declared for element type "property".
   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.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:824)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:778)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:750)
   at hbn.GetReport.main(GetReport.java:36)
(mapping.Collection                  174 ) Mapping class: hbn.Customer -> customers
(cfg.Configuration                   871 ) Configured SessionFactory: null
(mapping.Collection                  976 ) Mapping collection: hbn.Customer.orders -> orders
(impl.SessionFactoryImpl             140 ) building session factory
(dialect.Dialect                     37  ) Using dialect: net.sf.hibernate.dialect.MySQLDialect
(connection.DriverManagerConnectionProvider 41  ) Hibernate connection pool size: 20
(connection.DriverManagerConnectionProvider 70  ) using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/hibernatetest
(connection.DriverManagerConnectionProvider 71  ) connection properties: {user=root}
(impl.SessionFactoryImpl             170 ) Use outer join fetching: false
(impl.SessionFactoryImpl             193 ) Use scrollable result sets: true
(impl.SessionFactoryImpl             194 ) JDBC 2 max batch size: 15
(impl.SessionFactoryObjectFactory    82  ) no JDNI name configured
(impl.SessionFactoryImpl             287 ) Query language substitutions: {}
Customer: Stephan
      Order: Palle
      Order: Hoere
Customer: Gawie
      Order: Klippe
Customer: Clint
Customer: Manfred


MySQL 4.1
[/code]


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

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.