En tant que débutant dans HQL, j'ai une requête SQL que j'essaie de transformer en hql.Erreur de syntaxe HQL: 'NHibernate.Hql.Ast.ANTLR.QuerySyntaxException'
select * from (
select *
from CORRELATION_VUE
where film = v_oldidfilm and FILM2 not in (
select c.idfilm
from cotes c
where idclient = v_idclient)
order by CORRELATION desc
)
where rownum <= 3;
Donc HQL j'essaie ceci:
ISession s = NHibernateHelper.GetCurrentSession();
ITransaction tx = s.BeginTransaction();
IQuery query = s.CreateQuery(
@"select u from (
select u from vueCorreliser u
where u.film = :idfilm
and u.FILM2 not in (
select c.idfilm from cote c
where c.idclient = :idclient)
order by u.CORRELATION desc)
where rownum <= 3; ")
.SetInt32("idfilm", idfilm)
.SetInt32("idclient", idclient);
IList<Film> result = query.List<Film>();
tx.Commit();
return result;
Mais je reçois une erreur de syntaxe sur la ligne CreateQuery
.
Qu'est-ce que j'ai fait de mal?
Merci
Même problème que dans cette [autre question] (/ q/42462497/1178314) de votre part! –
Copie possible de [Comment transformer cette requête SQL native en HQL] (http://stackoverflow.com/questions/42462497/how-to-transform-this-native-sql-query-to-an-hql) –