[hibernate-issues] [Hibernate-JIRA] Created: (EJB-262) hbm.xml mapping errors have no context making it hard to track down the cause

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Thu Jan 18 09:44:44 EST 2007


hbm.xml mapping errors have no context making it hard to track down the cause
-----------------------------------------------------------------------------

         Key: EJB-262
         URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-262
     Project: Hibernate Entity Manager
        Type: Improvement

  Components: EntityManager  
    Versions: 3.2.1    
    Reporter: Max Rydahl Andersen


Starting a Ejb3Configuration on e.g. jpwh-essentials lab4 where there is an error in one of the 5 hbm.xml files one get an exception that states:

Caused by: javax.persistence.PersistenceException: org.hibernate.MappingException: invalid mapping
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:247)
	... 16 more
Caused by: org.hibernate.MappingException: invalid mapping
	at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:672)
	at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:920)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:750)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
	... 16 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 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at org.dom4j.io.SAXReader.read(SAXReader.java:465)
	at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:668)
	... 20 more

When entitymanager parses hbm.xml it apparently create alot of inputstreams and asks hibernate to parse them....the entitymanger should keep track of where those files come from and throw an exception stating which file/resource actually fails.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list