Hi all,
I have some problems using the <any> attribute with a class hierarchy,
NHibernate throwing a System.Collections.Generic.KeyNotFoundException
while saving my instances.
In details :
I have a class with one property declared as an Interface, and many
classes implementing this interface. So I used the <any> attribute to
map this property :
<class name="OwnerClass" ... >
...
<any name="Composant" ... >
<meta-value value="1" class="ClassA" />
<meta-value value="2" class="ClassB" />
...
</any>
</class>
unfortunately, ClassB is abstract and I have some concrete child
classes which can be instantiated.
NHibernate throws an exception while saving my instances when
Composant is an instance of a concrete class derived from ClassB.
Examining what happens with the database, the Composant entity is
correctly inserted, and the KeyNotFoundException is thrown before
inserting the OwnerClass entity. There's no problem when Composant is
of type ClassA.
Does I deduce that class hierarchies are not supported in the any
element, or is there any thing I have mist in using it ?
Thanks in advance.
--
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.