开发者

I'm not able to fetch records from this NHibernate mapping

开发者 https://www.devze.com 2023-04-01 10:15 出处:网络
<?xml version=\"1.0\" encoding=\"utf-8\"?> <hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\">
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

  <class name="CITI.manageID.Data.Entities.AuthUserKioskRoleMap,CITI.manageID.Data" table="AuthUserKioskRoleMap" lazy="false">
    <composite-id name="Id" class="CITI.manageID.Data.Entities.AuthUserKioskRoleMapId,CITI.manageID.Data">
      <key-many-to-one name="AuthUsers" class="CITI.manageID.Data.Entities.AuthUsers,CITI.manageID.Data" column="UserID" />
      <key-many-to-one name="KioskInfo" class="CITI.manageID.Data.Entities.KioskInfo,CITI.manageID.Data" column="KioskID" />
      <key-many-to-one name="AuthRole" class="CITI.manageID.Data.Entities.AuthRole,CITI.manageID.Data" column="Roleid" />
    </composite-id>
    <property name="Status" column="Status" type="string" />
    <property name="CreatedBy" column="CreatedBy" type="string" not-null="true" />
    <property name="CreatedOn" column="CreatedOn" type="DateTime" not-null="true" />
    <property name="UpdatedBy" column="UpdatedBy" type="string" />
    <property name="UpdatedOn" column="UpdatedOn" type="DateTime" />
    <many-to-one name="AuthRole" column="Roleid" cascade="save-update" not-null="true" />
    <many-to-one name="AuthUsers" column="UserID" cascade="save-update" not-null="true" />
    <many-to-one name="KioskInfo" column="KioskID" cascade="save-update" not-null="true" />
  </class>
</hibernate-mapping>

I have tried following

ICriteria crit = SessionRepository.CreateRepositoryCriteria(typeof(AuthUserKioskRoleMap));
crit.Add(Expression.InsensitiveLike("AuthUsers.Userid", AuthUserID));
crit.Add(Expression.InsensitiveLike("KioskInfo.Kioskid", Kiosk开发者_运维问答ID));
crit.Add(Expression.InsensitiveLike("Id.AuthUsers.Status", "A"));
crit.Add(Expression.InsensitiveLike("Id.KioskInfo.Status", "A"));
crit.Add(Expression.InsensitiveLike("Id.AuthRole.Status ", "A"));
crit.Add(Expression.InsensitiveLike("Status", "A"));
crit.AddOrder(new Order("ImageType", true));

ApplicantFaceInfoList = crit.List<AuthUserKioskRoleMap>();

Please Help


Is this mapping file called AuthUserKioskRoleMap.hbm.xml and is set as an embeddable object in Visual Studio?

Notice the hbm.xml extension as this is important.

If this still does not work then please provide more information e.g. any errors and/or the configuation code.

0

精彩评论

暂无评论...
验证码 换一张
取 消