I had the same issue just now. The HQL query in question was:
select qg
from QuestionGroup qg
    inner join qg.SurveyItems as si
    inner join si.SurveyPage as sp
    inner join sp.Survey as survey
    where survey.ID in :surveyIds

And i got also  NHibernate.Hql.Ast.ANTLR.QuerySyntaxException :
Exception of type 'Antlr.Runtime.NoViableAltException' was thrown.
near line 7, column 23.

Of course, this type of exception simply does not help to understand
what is actually wrong here. A more specific exception would help.
The reason for this error was that the parameter must be surrounded by
parenthesis, since it does not happen automatically

The working query looks like this:
select qg
from QuestionGroup qg
    inner join qg.SurveyItems as si
    inner join si.SurveyPage as sp
    inner join sp.Survey as survey
    where survey.ID in (:surveyIds)


Hope that gives some ideas.





On 3 Gruo, 23:23, "Dotan N." <[email protected]> wrote:
> sorry to bring this up but i'm having similar issues with the suggested fix:
>
> Session.Delete(string.Format("from Tokens where UserId = {0}", userId));
>
> same exception. any idea?
>
> On Thu, Aug 6, 2009 at 6:17 AM, adressin <[email protected]> wrote:
>
> > Duh... thanks for the extra eyes!
>
> > -Aaron
>
> > On Aug 5, 7:17 pm, Fabio Maulo <[email protected]> wrote:
> > > I have done thisThe exception say " near line 1, column 7"
> > > and I found
> > > "SELECT from"
> > > That is a clear wrong HQL since between "SELECT" and "from" you put what
> > you
> > > are selecting or you should start directly with "from".
>
> > > 2009/8/5 adressin <[email protected]>
>
> > > > Hello,
>
> > > >  I just upgraded to NHibernate 2.1 and am now getting an error on a
> > > > query that use to work. Any ideas? Thanks in advance.
>
> > > > -Aaron
>
> > > > NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type
> > > > 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 7
> > > > [SELECT from Tradewinds.Samms.Core.Domain.TransactionHeader as tHeader
> > > > where tHeader in ( SELECT DISTINCT tDetail.TransactionHeader from
> > > > Tradewinds.Samms.Core.Domain.TransactionDetail as tDetail where
> > > > tDetail in  (select tap.TransactionDetailRecord from
> > > > Tradewinds.Samms.Core.Domain.TransactionApprovalHistory as tap where
> > > > tap.ApprovalStatus = :approvalStatus and tap.RouteEntry.User.UsrCode
> > > > = :approver ) )]
> > > >   at NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException()
> > > >   at NHibernate.Hql.Ast.ANTLR.HqlParseEngine.Parse()
> > > >   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Parse(Boolean
> > > > isFilter)
> > > >   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile
> > > > (IDictionary`2 replacements, Boolean shallow, String collectionRole)
> > > >   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String
> > > > collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
> > > > ISessionFactoryImplementor factory)
> > > >   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean
> > > > shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
> > > > factory)
> > > >   at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String
> > > > queryString, Boolean shallow, IDictionary`2 enabledFilters)
> > > >   at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String
> > > > query, Boolean shallow)
> > > >   at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String
> > > > queryString)
>
> > > --
> > > Fabio Maulo
> > --~--~---------~--~----~------------~-------~--~----~
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en
> > -~----------~----~----~----~------~----~------~--~---

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to