New Message on dotNET User Group Hyd

Unknown entity class Exception in NHibernate

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: SriSrivatsav

Hi All,

I am new NHibernate. I am getting "NHibernate:MappingException: Unknown Entity" exception. Following is the code and the mapping file I am using:

<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">

<class name="SimpleExample.Customer, SimpleExample" table="Customers">

<id name="CustomerID" type="String" length="5">

<generator class="assigned" />

</id>

<property name="CompanyName" type="String" length="40"/>

<property name="ContactName" type="String" length="30"/>

<property name="ContactTitle" type="String" length="30"/>

<property name="Phone" type="String" length="24"/>

</class>

</hibernate-mapping>

 

Configuration cfg = new Configuration();

cfg.AddAssembly("SimpleExample");

ISessionFactory factory = cfg.BuildSessionFactory();

using(ISession session = factory.OpenSession())

{

Customer customer = (Customer)session.Load(typeof(Customer),"ALFKI");

Msg.InnerHtml = "<BR>" + customer.ContactName + "<BR>";

session.Close();

}

Error:

Unknown entity class: SimpleExample.Customer

using(ISession session = factory.OpenSession())
Line 56: {
Line 57: Customer customer = (Customer)session.Load(typeof(Customer),"ALFKI");
Line 58: Msg.InnerHtml = "<BR>" + customer.ContactName + "<BR>";
Line 59: session.Close();

 

Where I am going wrong. Please let me know.


Thanks in Advance,
Kalyan Raman Y.V


All that you wanted to know about Ms Beautiful Lips Search for Katrina

View other groups in this category.


Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to