Hello,
I have a class "Plate" which contains a collection of classes "Well". But the "Well" class don't point to the parent class.
So I have a "Well" table which has a foreign key to the "Plate" table only.
When I call the Session.Save() method, only the data of the Plate class are written in the "Plate" table, and nothing in the "Well" table. And I have no exception.
Could you help me, please ?
Here are my classes and mappings files :
Code:
public class Plate
{
private string _id;
private string _name;
private IList _wells = new ArrayList();
. . .
}
Code:
public class Well
{
private string _id;
private string _name;
. . .
}
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
<class name="BusinessLayer.Plate, BusinessLayer" table="[Plate]">
<id name="_id" column="Id" type="string">
<generator class="uuid.hex" />
</id>
<property name="_name" column="Name" type="String"/>
<bag name="_wells" table="[Well]" inverse="true">
<key column="Id"/>
<one-to-many class="BusinessLayer.Well, BusinessLayer"/>
</bag>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
<class name="BusinessLayer.Well, BusinessLayer" table="[Well]">
<id name="_id" column="Id" type="string">
<generator class="uuid.hex" />
</id>
<property name="_name" column="Name" type="String"/>
</class>
</hibernate-mapping>
Thank you for your help.