使用此hbm文件:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping assembly="BrokerPlatform.Core" namespace="BrokerPlatform.Core.Model.Common" xmlns="urn:nhibernate-mapping-2.2">
<import class="RatingDTO, BrokerPlatform.Core"/>
<import class="ClientDTO, BrokerPlatform.Core"/>
<import class="DocumentDTO, BrokerPlatform.Core"/>
<import class="UserDTO, BrokerPlatform.Core"/>
<resultset name="RatingsResultSet">
<return alias="rv" class="RatingDTO, BrokerPlatform.Core">
<return-property column="rv.id_rating" name="id_rating" />
<return-property column="rv.Total" name="Total" />
<return-property column="rv.Rating" name="Rating"></return-property>
</return>
<return-join alias="u" property="rv.User">
<return-property column="u.Username" name="Username"></return-property>
<return-property column="u.id_user" name="id_user"></return-property>
</return-join>
<return-join alias="c" property="rv.Client">
<return-property column="c.CnpCui" name="CnpCui"></return-property>
<return-property column="c.Name" name="Name"></return-property>
<return-property column="c.DataNasterii" name="DataNasterii"></return-property>
<return-property column="c.Telefon" name="Telefon"></return-property>
<return-property column="c.Email" name="Email"></return-property>
</return-join>
<return-join alias="dv" property="rv.Documents">
<return-property column="dv.id_document" name="id_document"></return-property>
<return-property column="dv.Name" name="Name"></return-property>
<return-property column="dv.EndDate" name="EndDate"></return-property>
<return-property column="dv.NumarPolita" name="NumarPolita"></return-property>
</return-join>
</resultset>
<sql-query name="GetRatingClienti"
resultset-ref="RatingsResultSet"
cacheable="true" cache-mode="normal">
<query-param name="ItemsPerPage" type="System.Int32" />
<query-param name="Page" type="System.Int32" />
<query-param name="id_produs" type="System.Int32" />
<query-param name="CnpCui" type="System.String" />
<query-param name="Email" type="System.String" />
<query-param name="Marca" type="System.String"/>
<query-param name="NumarInmatriculare" type="System.String"/>
<query-param name="SerieSasiu" type="System.String"/>
<query-param name="PolicyDate" type="System.DateTime"/>
<query-param name="id_user" type="System.Int32"/>
exec dbo.GetRatingClient @ItemsPerPage = :ItemsPerPage, @Page = :Page,@id_produs = :id_produs,@CnpCui = :CnpCui,@Email = :Email,@Marca = :Marca,@NumarInmatriculare = :NumarInmatriculare,@SerieSasiu = :SerieSasiu,@PolicyDate = :PolicyDate,@id_user = :id_user
</sql-query>
<!--<sql-query name="GetRatingClient">
<return alias="rv" class="RatingDTO">
<return-property column="rv.id_rating" name="id_rating" />
<return-property column="rv.Total" name="Total" />
<return-property column="rv.Rating" name="Rating"></return-property>
</return>
<return-join alias="u" property="RatingDTO.User">
<return-property column="u.Username" name="Username"></return-property>
<return-property column="u.id_user" name="id_user"></return-property>
</return-join>
<return-join alias="c" property="RatingDTO.Client">
<return-property column="c.CnpCui" name="CnpCui"></return-property>
<return-property column="c.Name" name="Name"></return-property>
<return-property column="c.DataNasterii" name="DataNasterii"></return-property>
<return-property column="c.Telefon" name="Telefon"></return-property>
<return-property column="c.Email" name="Email"></return-property>
</return-join>
<return-join alias="dv" property="RatingDTO.Documents">
<return-property column="dv.id_document" name="id_document"></return-property>
<return-property column="dv.Name" name="Name"></return-property>
<return-property column="dv.EndDate" name="EndDate"></return-property>
<return-property column="dv.NumarPolita" name="NumarPolita"></return-property>
</return-join>
exec dbo.GetRatingClient :ItemsPerPage, :Page, :id_produs, :CnpCui, :Email, :Marca, :NumarInmatriculare, :SerieSasiu, :PolicyDate, :id_user
</sql-query>-->
</hibernate-mapping>
我收到一条通用错误消息,说明GetRatingClient中存在错误。在上面的xml中,我使用了两种不同的映射,但没有成功。我究竟做错了什么?是的,它是一个.hbm文件,设置为嵌入式内容。 DTO的类未映射为持久实体。
错误是:{“命名查询中的错误:{GetRatingClienti}”} 和stacktrace:
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping映射,设置设置,EventListeners侦听器) C:\用户\ oskar.berggren \文件\项目\ NHibernate的核-3 \ SRC \ NHibernate的\默认地将Impl \ SessionFactoryImpl.cs:线 372在NHibernate.Cfg.Configuration.BuildSessionFactory()中 C:\用户\ oskar.berggren \文件\项目\ NHibernate的核-3 \ SRC \ NHibernate的\ CFG \ Configuration.cs:线 1258年 BrokerPlatform.Infrastructure.PlatformSessionFactoryStorage.CreateSessionFactory(IAppInstance appInstance)in d:\ ASDF \干线\ BrokerPlatform \ BrokerPlatform.Infrastructure \ ContextStorage \ BrokerSessionFactoryStorage.cs:行 54点 BrokerPlatform.Infrastructure.PlatformSessionFactoryStorage.GetSessionFactory(IAppInstance 实例,布尔&amp; newCreated)in d:\ ASDF \干线\ BrokerPlatform \ BrokerPlatform.Infrastructure \ ContextStorage \ BrokerSessionFactoryStorage.cs:行 175