I had a similar problem once with select.
Try
s.Delete("from Object as o");
if it is the same problem that should solve it.
-----Original Message-----
From: Aykut Soysal <[email protected]>
Date: Wed, 20 Jan 2010 03:33:33
To: nhusers<[email protected]>
Subject: [nhusers] Re: ANTLR Query SyntaxException
I have a similar problem:
s.Delete("from Object o");
when i call this, i get an exception
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException : Exception of type
'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 5
[from Object o]
stacktrace:
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.SessionImpl.List(String query, QueryParameters
queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List(String query, QueryParameters
parameters)
at NHibernate.Impl.SessionImpl.Find(String query, Object[] values,
IType[] types)
at NHibernate.Impl.SessionImpl.Delete(String query, Object[] values,
IType[] types)
at NHibernate.Impl.SessionImpl.Delete(String query)
it says column 5 but it "Object" do i need some special syntax? i try
to use paranthesis in various combinations but i guess its only for
parameters...
am i missing something?
i am using NHibernate 2.1.2.4000 (2.1.2.4000)
thanks,
On Dec 14 2009, 2:30 pm, Fabio Maulo <[email protected]> wrote:
> I have the same problem in VisualStudio
> if a<5
> can't compile.
>
> "The reason for this error was that the parameter must be surrounded
> by parenthesis,
> since it does not happen automatically"
>
> 2009/12/14 Darius Damalakas <[email protected]>
>
>
>
>
>
> > 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]>
> > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroups.com>
>
> > > > 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]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> 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].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.