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: Contradicting error messages
PostPosted: Tue Nov 07, 2006 6:45 pm 
Newbie

Joined: Sun Oct 29, 2006 5:44 pm
Posts: 10
Location: New Zealand
I'm attempting to implement <map> and IDictionary.
Here is an example mapping file:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
                   assembly="TheBombShack.SpecialOps"
                   namespace="TheBombShack.SpecialOps"
                   >
  <class name="PartCategory"
    table="PartCategory">
    <id name="ID" unsaved-value="0">
      <generator class="native" />
    </id>
    <property name="CategoryName" length="100" />
    <map name="Parts" table="categoryparts" inverse="true">
      <key column="PartID"/>
      <index-many-to-many class="Part" column="PartCategoryID"/>
    </map>
  </class>
</hibernate-mapping>


This throws an error stating:
Code:
The element 'map' in namespace 'urn:nhibernate-mapping-2.0' has incomplete content. List of possible elements expected: 'urn:nhibernate-mapping-2.0:element urn:nhibernate-mapping-2.0:one-to-many urn:nhibernate-mapping-2.0:many-to-many urn:nhibernate-mapping-2.0:composite-element urn:nhibernate-mapping-2.0:many-to-any'.


OK, odd... I had thought the documentation had said use index-many-to-many. So I tried changing the index-many-to-many to a many-to-many.

This throws an error stating:
Code:
The element 'map' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'many-to-many' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:index urn:nhibernate-mapping-2.0:composite-index urn:nhibernate-mapping-2.0:index-many-to-many urn:nhibernate-mapping-2.0:index-many-to-any'.


So when I put in index-many-to-many I get told to put in many-to-many and vice versa.
Any suggestions on getting around this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 1:15 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
i think you have to change the order of the aaattributes in your mapping file. The collection attributes like <map> and <set> have to be placed directly after the <id> attribute.

Regards
Klaus


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 2:43 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
"Incomplete content" means it's expecting one more element.
"Invalid content" means some element is missing or the elements are in wrong order.

For <map> it should be <key>, then an index (<index>, <composite-index>, etc.), then <many-to-many> or whatever.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 4:53 am 
Newbie

Joined: Sun Oct 29, 2006 5:44 pm
Posts: 10
Location: New Zealand
Thanks sergey, I had sort of figured that out, but couldn't get it to work as expected, so I dropped it in favour of sets.


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.