nhibernate - what wrong with this hql query, I use fetch in my hql to overload the child sets -


 string hql = "from customer c left outer join fetch c.orders"   + "where c.customerid=:id";   using(session)  {     return  session.createquery(hql).setint32("id",id).list<customer>();  } 

when excute code, there exception this:

eagerloadcustomerbyidthroughfetchtest : failednhibernate.hql.ast.antlr.querysyntaxexception : 引发类型为“antlr.runtime.mismatchedtokenexception”的异常。 near line 1, column 56 在 nhibernate.hql.ast.antlr.errorcounter.throwqueryexception() 在 nhibernate.hql.ast.antlr.hqlparseengine.parse() 在 nhibernate.hql.ast.antlr.astquerytranslatorfactory.createquerytranslators(string querystring, string collectionrole, boolean shallow, idictionary2 filters, isessionfactoryimplementor factory) 在 nhibernate.engine.query.hqlstringqueryplan.createtranslators(string hql, string collectionrole, boolean shallow, idictionary2 enabledfilters, isessionfactoryimplementor factory) 在 nhibernate.engine.query.hqlstringqueryplan..ctor(string hql, string collectionrole, boolean shallow, idictionary2 enabledfilters, isessionfactoryimplementor factory) 在 nhibernate.engine.query.hqlstringqueryplan..ctor(string hql, boolean shallow, idictionary2 enabledfilters, isessionfactoryimplementor factory) 在 nhibernate.engine.query.queryplancache.gethqlqueryplan(string querystring, boolean shallow, idictionary`2 enabledfilters) 在 nhibernate.impl.abstractsessionimpl.gethqlqueryplan(string query, boolean shallow) 在 nhibernate.impl.abstractsessionimpl.createquery(string querystring) 在 data.nhibernatesample.eagerloadcustomerbyidthroughfetch(int32 id) 位置 delayloadtest.cs: line 80 在 nhibernatedataacesstest.nhibernatesamplefixture.eagerloadcustomerbyidthroughfetchtest() 位置 lazyload.cs: line 73

what wrong in code ,thank you

you sql malformed, there no space between: "...c.orders" + "where...".


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -