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.  [ 2 posts ] 
Author Message
 Post subject: IDictionary key does not update
PostPosted: Thu Nov 02, 2006 7:33 pm 
Newbie

Joined: Mon Jul 31, 2006 10:35 am
Posts: 3
Hibernate version:
1.02
Mapping documents:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" >

<class name="Demo.domainClasses.SchoolClass, Demo" table="schoolclasses">
<id name="UOID" column="uoid" type="Int32">
<generator class="identity"/>
</id>

<map name="StudentList" table="Students" inverse="true" cascade="all-delete-orphan">
<key column="schoolclass_uoid" />
<index column="student_uoid" type="Int32" />
<one-to-many class="Demo._domainClasses.Student, Demo"/>
</map>

<property name="Name" column="name" type="String"/>

</class>

</hibernate-mapping>

Name and version of the database you are using:
Mysql 5

Basically I have a number of school classes that can have many students. I want to be able to search for student fast so I'm using IDictionary but I have a very annoying problem. As you can see I use the student ID(uoid) as the key of the IDictionary and I'm using Parent/Child relationship. The problem is that when I create new student and add it to a particular school class its ID is still 0. When I update the particular school class and flush the session Nhibernate creates the new student in the database and assigns it a ID (different that 0) but it does not update the key of the IDictionary which value remains set as 0.
Any ideas how I can fix this?
Tnx in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 03, 2006 1:48 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You can't use indexed collection (i.e. a map or a list) for an inverse one-to-many in NHibernate.


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