当我使用fetch时怎么办? “with”不起作用。
ISession session = NHibernateHelper.GetSession();
string sql = "FROM Filial fi " +
"left join fetch fi.LstUsuario usr " +
"with usr.NumSequencial = :idUsr " +
"order by fi.Nome";
IQuery query = session.CreateQuery(sql);
query.SetParameter("idUsr", usuario.NumSequencial, NHibernateUtil.Int64);
lstFilial = (List<Filial>)query.List<Filial>();
错误消息:意外令牌:[FROM Entidade.Filial fi left join fetch fi.LstUsuario usr with usr.NumSequencial =:idUsr order by fi.Nome]
SQL中的代码
select *
from TFILIAL fi
left join TPERMIS_USR_FILIAL usrFi
on fi.anum_sequ_filial = usrfi.anum_sequ_filial
and usrfi.anum_sequ_usuario = 2;
提前谢谢。