I've been fighting with this problem for a couple of days now, but I can't find the solution:
I have a table containing info about citizens - name, address etc, but also the id of each of the parents - who them selves of course are citizens too, and thus are in the same table.
My DTO looks something like this:
public class CitizenDTO
{
private int id;
private string name;
private CitizenDTO mother;
...
public CitizenDTO()
{
}
...
public CitizenDTO Mother
{
get { return mother;}
set {mother = value;}
}
}
and the corresponding hbm.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="GDCS.CivilRegister.Test.CitizenDTO, GDCS.CivilRegister" table="Citizen"
dynamic-update="true" lazy="true">
<id name="Id" column="ID">
<generator class="assigned" />
</id>
<property name="Name" type="string" column="name" not-null="true" />
<many-to-one
name="mother"
class="GDCS.CivilRegister.Test.CitizenDTO"
cascade="none"
outer-join="auto"
update="true"
insert="true"
foreign-key="mother_fk"
column="mothersid"
/>
</class>
</hibernate-mapping>
The problem is when I test it, I get the error message:
NHibernate.MappingException: could not find class: GDCS.CivilRegister.Test.CitizenDTO ---> System.TypeLoadException: Could not load type 'GDCS.CivilRegister.Test.CitizenDTO, NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc', check that type and assembly names are correct
at NHibernate.Util.ReflectHelper.ClassForName(String name)
but the moment I remove the self referencing parts (mother), It works perfectly, so I have a feeling there's something missing in my xml file? Can anybody help me with this?
Thanks a lot!
|