首页 新闻 会员 周边 捐助

NHibernate(Unable to locate persister for the entity)

1
悬赏园豆:30 [已关闭问题] 解决于 2013-08-29 15:58

错误信息

 

Unable to locate persister for the entity named 'Model.Customer'.
The persister define the persistence strategy for an entity.
Possible causes:
- The mapping for 'Model.Customer' was not added to the NHibernate configuration.

 

实体映射文件:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Model" namespace="Model">
<class name="Model.Customer,Model" table="Customer">
<id name="CustomerId" column="CustomerId" type="Int32">
<generator class="GuidNative"/>
</id>
<property name="versions" column="versions" type="string"></property>
<property name="firstName" column="firstName" type="string"></property>
<property name="lastName" column="lastName" type="string"></property>
</class>
</hibernate-mapping>

 

 

数据库配置文件

 

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">
Data Source=.;Initial Catalog=NHibernateSample;Persist Security Info=True;User ID=sa;pwd=sasa</property>
<property name="proxyfactory.factory_class">NHibernate.Bytecode.DefaultProxyFactoryFactory,NHibernate</property>
<property name="show_sql">true</property>
<property name="command_timeout">10</property>
<property name="adonet.batch_size">10</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<mapping assembly="Model"/>
</session-factory>
</hibernate-configuration>

Jes.Chen的主页 Jes.Chen | 初学一级 | 园豆:75
提问于:2013-08-29 15:08
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册