Hello All
I am tearing my hair out over this. I have browsed related issues, but to no avail.
Basically it looks like the Configuration loads in my hbm files without a hitch. However, as soon as I go to save an object, it throws the error 'Unknown Entity Class' as part of the MappingException.
My hbm.xml files are all embedded, and it can find them ok. (If I try doing AddClass(typeof(myclass)) it doesnt work however - it says it can't find the files even though they are there... doing it on assembly name instead seems to get past this)
My assembly name is PropertyTrackerBusiness
as an example, a class I have is declared as follows in Property.cs in the above assembly (which I have verified in project properties)
Code:
namespace PropertyTrackerBusiness.Domain
{
public class Property
{
//public props etc..
}
}
my Property.hbm.xml file is as follows:Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="PropertyTrackerBusiness.Domain.Property, PropertyTrackerBusiness" table="Properties">
<id name="Id" column="Id" type="Int64" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Description" column="Description" type="String" length="50"/>
<property name="Address1" column="Address1" type="String" length="50"/>
<property name="Address2" column="Address2" type="String" length="50"/>
<property name="Town" column="Town" type="String" length="50"/>
<property name="County" column="County" type="String" length="50"/>
<property name="Postcode" column="Postcode" type="String" length="50"/>
<property name="Country" column="Country" type="String" length="50"/>
</class>
</hibernate-mapping>
And this file is embedded.
In fact, I have checked the configuration object at runtime and it has imported all of my definitions.
Yet as soon as I do session.Save(property) it just says it can't find the entity..... Does anyone know of anything I am not doing?
I have a helper class which creates the factory and then gets the session. This seems to go through without a hitch. It's just when I do a save.....