Nhibernate Antlr.Runtime.NoViableAltException

return NHibernateSession.CreateQuery(@"TRUNCATE TABLE dbo.Exceptions").ExecuteUpdate();

An exception of type 'Antlr.Runtime.NoViableAltException' has been thrown. [TRUNCATE TABLE Exceptions] Description: An unhandled exception occurred during the execution of the current web request. Look at the stack trace for error information and it came from the code.

Exception Details: NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: An exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TRUNCATE TABLE Exceptions]

Source Error:

any idea why?

+5
source share
1 answer

TRUNCATE TABLE is not a valid HQL statement.

Use CreateSQLQueryinstead CreateQueryto execute SQL statements.

+18

All Articles