-->
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: problem with mapping one-to-many
PostPosted: Wed Jul 13, 2005 5:22 am 
Newbie

Joined: Tue May 10, 2005 10:54 am
Posts: 16
Location: Italy
Hibernate version:2

Hi all!
I want mapping 2 entity, Testata and Eccipienti. They've a one-to-many relationship: a Testata can have many Eccipienti and an Eccipienti can have only a Testata.
In Eccipienti I've a composite-id... so I map:
Code:
...
<hibernate-mapping package="com.omeopatici.dati.db.struttureDati" >
  <class name="Eccipienti" table="Eccipienti">
   <composite-id >
     <key-property name="codscheda" column="codscheda" type="int" />
     <key-property name="riga" column="riga" type="int" />
   </composite-id>
             
   <property name="descrizione" column="descrizione" type="String" />
   ....   
   ....       
</class>

And I've map Testata and relationship:
Code:
... 
<hibernate-mapping package="com.omeopatici.dati.db.struttureDati" >
  <class name="Testata" table="Testata" lazy="true">
    <id name="codscheda" column="codscheda" type="int">
           <generator class="native" />
    </id>
     .....
     ..... 
     
    <set name="eccipienti" lazy="true" inverse="true">
      <key column ="codscheda"/>
      <key column ="riga"/>             
      <one-to-many class="Eccipienti" />
    </set>
</class>


But when I do hbm2java Eccipienti.hbm.xml Testata.hbm.xml I've this error:
Quote:
13-lug-2005 10.40.16 net.sf.hibernate.tool.hbm2java.CodeGenerator$1 error
GRAVE: Error parsing XML: file:/C:/hibernate-2.1/tools/bin/Testata.hbm.xml(62)
org.xml.sax.SAXParseException: The content of element type "set" must match "(meta*,(cache|jcs-cache
)?,key,(element|one-to-many|many-to-many|composite-element|many-to-any))".
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.jdom.input.SAXBuilder.build(SAXBuilder.java:354)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:689)
at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:100)
13-lug-2005 10.40.16 net.sf.hibernate.tool.hbm2java.Generator generate
INFO: Generating 2 in generated

Where's the error? How can I map this relationship?
Please, help me :(


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.