0
"메시지 : 하나 이상의 필수 매개 변수에 값이 지정되지 않았습니다."라는 오류가 발생합니다. MBUnit에서 코드를 테스트하려고 할 때.NHibernate 명명 된 쿼리에서 매개 변수의 값을 제공하는 방법
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="myApplication.Core" namespace="studentTrak">
<class name="UniversityCourse" table="UniversityCourse" lazy="true">
<id name="Id" column="ID" type="int">
<generator class="native" />
</id>
<property name="Name" column="Name" type="string" not-null="true"/>
<property name="Description" column="Description" type="string" />
<many-to-one name="BestStudent" class="Student"/>
<loader query-ref="GetBestStudent"/>
</class>
<sql-query name="GetBestStudent" callable="true">
<return class="Student">
</return>
SELECT * FROM BestStudents WHERE CourseId = ?
</sql-query>
</hibernate-mapping>
엔티티에 대한 코드는 다음과 같습니다
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace studentTrak
{
public class UniversityCourse
{
public virtual int Id { get; set; }
public virtual String Description { get; set; }
public virtual String Name {get;set;}
public virtual Student BestStudent
{
get;
set;
}
}
}
어떻게 쿼리의 요구라는 것을 가치를 제공합니까?
확인 완벽 .... 그래서 어떻게 매개 변수에 대한 값을 제공합니까? – MadSeb
도전은 몇 가지 이유로 내 코드에서 "세션"에 액세스 할 수 없다는 것입니다 ... 그래서 매핑에서 매개 변수를 설정해야합니다 ... 어떤 방식 으로든 할 수 있습니까? – MadSeb
SELECT * FROM BestStudents WHERE CourseId = 5 – Will