好像是你的
Zone.hbm.xml
寫的不規範,
貼出來看看?

解决方案 »

  1.   

    <?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="com.huafu.dayplan.bean.basic.Zone" table="TB_Zone">
          
          <id name="zoneId" column="ZoneID" type="java.lang.String">
             <generator class="uuid.hex"/>
          </id>
          
          <property name="zoneName" column="ZoneName" type="java.lang.String" length="30" not-null="true"/>
          <property name="zoneNo" column="ZoneNO" type="java.lang.String" length="30" not-null="true"/>
          <property name="descript" column="Descript" type="java.lang.String" length="100"/>
          
          <set name="units" lazy="true" inverse="true" cascade="all" > 
            <key column="ZoneID"/> 
            <one-to-many class="com.huafu.dayplan.bean.basic.Unit" /> 
          </set> 
          
       </class>
    </hibernate-mapping>这个文件没做任何改动,昨天还没问题呢!
      

  2.   

    我也遇到XML问题,可是我是改自hibernate自带的xml文件的呀,错误如下:
    net.sf.hibernate.MappingException: Error reading resource: orm/person.hbm.xml at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:336) at orm.Client.main(Client.java:11)Caused by: net.sf.hibernate.MappingException: invalid mapping at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:284) at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333) ... 1 moreCaused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))". at weblogic.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232) at weblogic.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173) at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:371) at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:305) at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1918) at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:851) at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008) at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469) at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329) at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525) at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581) at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175) at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135) at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138) at org.dom4j.io.SAXReader.read(SAXReader.java:339) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283) ... 2 more17:08:21,793 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(11) The content of element type "class" must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))".Exception in thread "main"
      

  3.   

    去http://forum.javaeye.com,那里有不少hibernate的高手
      

  4.   

    duplicate import: Zone你重复引入了一个xml文件
      

  5.   

    <set name="units" lazy="true" inverse="true" cascade="all" > 
            <key column="ZoneID"/> 
            <one-to-many class="com.huafu.dayplan.bean.basic.Unit" /> 
          </set> 
    好像这里出问题了,你删掉这个试试