NHibernate.MappingException: Unknown entity class: QuickStart.Cat
异常详细信息: NHibernate.MappingException: Unknown entity class: QuickStart.Cat
源错误:
行 28: princess.Weight = 7.4f;
行 29:
行 30: session.Save(princess);
行 31: tx.Commit();
文件: c:\inetpub\wwwroot\quickstart\webform1.aspx.cs 行: 30
cat.hbm.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="QuickStart" assembly="QuickStart">
<class name="Cat" table="Cat">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by NHibernate with the UUID pattern. -->
<id name="Id">
<column name="CatId" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="16" not-null="true" />
</property>
<property name="Sex" />
<property name="Weight"/>
</class>
</hibernate-mapping>
web.config文件
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<!-- Add this element -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Server=(local);database=NHibernate;user id=sa;password=sa</property>
<property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<mapping assembly="QuickStart" />
</session-factory>
</hibernate-configuration>
cat类:
public class Cat
{
private string id;
private string name;
private char sex;
private float weight;
public Cat()
{
}
public string Id
{
get { return id; }
set { id = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
public char Sex
{
get { return sex; }
set { sex = value; }
}
public float Weight
{
get { return weight; }
set { weight = value; }
}
}
请教各位:为什么出现上面如标题所示得问题啊?急.