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!
|