-->
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.  [ 4 posts ] 
Author Message
 Post subject: Error parsing MiddleGen generated XML mapping file
PostPosted: Fri May 28, 2004 10:54 am 
Newbie

Joined: Fri May 28, 2004 10:31 am
Posts: 4
Hello, I've been trying to use my MiddleGen generated mapping file, but Hibernate keeps complaining about this file

Quote:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>

<!--
Created by Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="com.sgam.tanis.hibernate.VTnsUniverse"
table="V_TNS_UNIVERSE"
>
<property
name="universeId"
type="long"
column="UNIVERSE_ID"
not-null="true"
length="12"
/>
<property
name="universeName"
type="java.lang.String"
column="UNIVERSE_NAME"
not-null="true"
length="60"
/>
<property
name="fprivate"
type="boolean"
column="PRIVATE"
not-null="true"
length="1"
/>
<property
name="owner"
type="java.lang.String"
column="OWNER"
not-null="true"
length="60"
/>
<property
name="structureId"
type="long"
column="STRUCTURE_ID"
not-null="true"
length="12"
/>
<property
name="structureName"
type="java.lang.String"
column="STRUCTURE_NAME"
not-null="true"
length="60"
/>
<property
name="universeCount"
type="java.math.BigDecimal"
column="UNIVERSE_COUNT"
length="22"
/>

<!-- associations -->

<set name="funds" cascade="all" inverse="false" lazy="true">
<key column="FUND_ID" />
<many-to-many class="com.sgam.tanis.hibernate.VTnsFund" />
</set>

</class>
</hibernate-mapping>


with the following error Message

Quote:

GRAVE: Error parsing XML: XML InputStream(75) 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*))".


net.sf.hibernate.MappingException: Error reading resource: com/sgam/tanis/hibernate/VTnsUniverse.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:354)
at com.sgam.tanis.FundService.list(FundService.java:73)
at com.sgam.tanis.GetFundListAction.execute(GetFundListAction.java:29)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
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:351)
... 32 more
Caused 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 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.DTDConfiguration.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:339)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)
... 33 more


Is there a problem with the DTD or am I missing something ?
I use hibernate 2.1 with JDom provided with the distribution...
The SGBD is Oracle 9i

Please Help !


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 12:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There is no primary or composite key in the mapping. Are you sure you have not edited the output? I cannot see how this was generated without a key. Maybe a JDBC driver problem.

What version were you using?
What database were you using?
In anycase, please provide a DDL script for the table and create a JIRA entry for the problem.

NOTE: Please use the Tools forum in the future as I monitor it closely.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 4:14 am 
Newbie

Joined: Fri May 28, 2004 10:31 am
Posts: 4
Thx David,
Actually I figured out what was the problem yesterday :

The missing id element.

The fact is that, I generate my classes from view in the ORACLE database, and since there are no relations and no primary keys defined in the views ...
So I guess i've to add it myself in the generated files, or I have to found a workaround that uses the associated tables.

I'll make a post on that problem on the tools category.

Thx again.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 30, 2004 8:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Hmmm. I will have to check this. If there is no keys then it should generate one large composite key. I have to check on views. Alternaticely, you can use the table tag and tell middlegen to make column X the key.


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

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.