Estoy intentando hacer una consulta mediante HQL en Nhibernate. La consulta es la siguiente:
Código:
pero me da el siguiente error:"Select b.prIdModoT " + "from GEIS.Service.CUsuarioZona as a inner join a.prIdZona as b, " + "(Select prIdModoT as Modo, count(prId) as NumSubmodosTotal " + "from GEIS.Service.CZona " + "where prTipo = 'submodo' " + "group by prIdModoT) as c " + "where b.prTipo = 'submodo' " + "and b.prIdModoT = Modo " + "and a.prIdUsuario = 35 " + "group by a.prIdUsuario, b.prIdModot, c.NumSubmodosTotal " + "having count(b.prId) = c.NumSubmodosTotal " + "order by a.prIdUsuario, b.prIdModoT";
NHibernate.QueryException was caught
Message="in expected: Select [Select b.prIdModoT from GEIS.Service.CUsuarioZona as a inner join a.prIdZona as b, (Select prIdModoT as Modo, count(prId) as NumSubmodosTotal from GEIS.Service.CZona where prTipo = 'submodo' group by prIdModoT) as c where b.prTipo = 'submodo' and b.prIdModoT = Modo and a.prIdUsuario = 35 group by a.prIdUsuario, b.prIdModot, c.NumSubmodosTotal having count(b.prId) = c.NumSubmodosTotal order by a.prIdUsuario, b.prIdModoT]"
Source="NHibernate"
QueryString="Select b.prIdModoT from GEIS.Service.CUsuarioZona as a inner join a.prIdZona as b, (Select prIdModoT as Modo, count(prId) as NumSubmodosTotal from GEIS.Service.CZona where prTipo = 'submodo' group by prIdModoT) as c where b.prTipo = 'submodo' and b.prIdModoT = Modo and a.prIdUsuario = 35 group by a.prIdUsuario, b.prIdModot, c.NumSubmodosTotal having count(b.prId) = c.NumSubmodosTotal order by a.prIdUsuario, b.prIdModoT"
StackTrace:
at NHibernate.Hql.Classic.FromParser.Token(String token, QueryTranslator q)
at NHibernate.Hql.Classic.ClauseParser.Token(String token, QueryTranslator q)
at NHibernate.Hql.Classic.PreprocessingParser.Token(S tring token, QueryTranslator q)
at NHibernate.Hql.Classic.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q)
at NHibernate.Hql.Classic.QueryTranslator.Compile()
at NHibernate.Hql.Classic.QueryTranslator.Compile(IDi ctionary replacements, Boolean scalar)
at NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow, IDictionary enabledFilters)
at NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar)
at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters, IList results)
at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
at NHibernate.Impl.QueryImpl.List()
at GEIS.Domain.CUsuarioNHibernateSrv.AOSelectModosCom pletos(Int32 nIdUsuario) in C:\proyectos\GEIS_Informes\GEIS_Domain\CUsuarioNHi bernateSrv.cs:line 136
InnerException:
¿Alguien sabe a que se debe este error? He comprobado el mapeo y el nombre de las clases y las propiedades y está todo bien.
Gracias