-->
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.  [ 3 posts ] 
Author Message
 Post subject: Error with an IDictionary Collection
PostPosted: Thu Nov 17, 2005 6:32 pm 
Newbie

Joined: Thu Nov 17, 2005 6:28 pm
Posts: 2
Hi there,

I have a collection of Kids, defined as IDicitionary, in an employee class. When i try to load the employees and subsequently the kids of the employees I get back this error:


"The type NHibernate.Collection.Set can not be assigned to a property of type System.COllections.IDictionary setter of HibernateAppTest.Employee.Kids"

Any ideas, all of the XML mappings look correct base off the tutorial from TSS (Dept -> classes example). If i alter the property setter to be an object, instead of the IDictionary it works fine. Is there something Im missing? Id rather not have to cast into/from a seperate property just to be able to use the name/value pairness of it. That is if its even storing it as that...havnt tested that far yet.

Thanks for any help,
Aaj


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 6:33 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The tutorial is very outdated, use Iesi.Collections.ISet instead of an IDictionary if you use sets. Or map the dictionary using <map>.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 6:23 pm 
Newbie

Joined: Thu Nov 17, 2005 6:28 pm
Posts: 2
Thanks! However, Im now running into a new problem, hehe.

Here is the map of the collection (EmpID is the forgien key that relates a kid back to an employee)

<map name="Kids" cascade="all">
<key column="EmpID" />
<index column="KidID" type="Int32" />
<one-to-many class="HibernateAppTest.Kid, HibernateAppTest"/>
</map>

I am getting the following error:
"could not initialize collection: [HibernateAppTest.Employee.Kids#1005]"

Im assuming that the 1005 is an ID, the only ID of that number (anywhere in the DB, this is a very small test) is one of the employees and they have no kids assigned to them.

Any thoughts?
Aaj


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.