Hi;
I´m just learning thow to use nHibernate and I´ve been trying to map
this relationship:
public class Person
{
private int person_id;
private IDictionary<int, Person>
}
public class Publication
{
private int publication_id;
private Person p;
}
What I want to do is have the dictionary with the publicactions, and
the publication_id as key of it; so I did this:
In Person.hbm.xml:
<map name="Publications" inverse="true" cascade="all-delete-orphan">
<key column="person_id"/>
<index column="publication_id" type="int"/>
<one-to-many class="Publication"/>
</map>
And in Publication.hbm.xml:
<many-to-one name="publicator" column="person_id" not-null="true"/>
So, when I´m testing it, I can add 1 publication to the person and
persist it, but when I try to add another onr it doesn´t work, says
that I cant add it because there is already a publication with the
same key.
Is there a way to have this relationship, or whit the dictionary is
impossible to have it?
Thank you very much!
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.