0
 string hql = "from Customer as c left outer join fetch c.Orders" 
 + "where c.CustomerId=:id";

 using(Session)
 {
    return  Session.CreateQuery(hql).SetInt32("id",id).List<Customer>();
 }

コードを実行すると、次のような例外があります。

EagerLoadCustomerByIdThroughFetchTest : FailedNHibernate.Hql.Ast.ANTLR.QuerySyntaxException : NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException() の NHibernate.Hql. Ast.ANTLR.HqlParseEngine.Parse() で NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryString, String collectionRole, Boolean Shallow, IDictionary 2 filters, ISessionFactoryImplementor factory) 在 NHibernate.Engine.Query.HQLStringQueryPlan.CreateTranslators(String hql, String collectionRole, Boolean shallow, IDictionary2 enabledFilters, ISessionFactoryImplementor factory) で NHibernate.Engine.Query.HQLStringQueryPlan..ctor(文字列 hql、文字列 collectionRole、ブール型の浅い、IDictionary2 enabledFilters, ISessionFactoryImplementor factory) 在 NHibernate.Engine.Query.HQLStringQueryPlan..ctor(String hql, Boolean shallow, IDictionary2 enabledFilters, ISessionFactoryImplementor factory) NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Booleanshallow, IDictionary`2 enabledFilters) NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String query, Booleanshallow) NHibernate.Impl.AbstractSessionImpl. CreateQuery(String queryString) Data.NhibernateSample.EagerLoadCustomerByIdThroughFetch(Int32 id) の位置 DelayLoadTest.cs: 80 行目 NhibernateDataAcessTest.NhibernateSampleFixture.EagerLoadCustomerByIdThroughFetchTest() の位置 LazyLoad.cs: 73 行目

私のコードで何が間違っていますか、ありがとう

4

1 に答える 1