Hello,

I'm trying to perform an update using HQL:

string query = @"insert into UserAudit (Page, [User]) select :page,
u.Id from User u where u.Id = :userId";

 sqlQuery = session.CreateQuery( query )
                .SetParameter( "page", requestedPage )
                .SetParameter( "userId", UserId );
 sqlQuery.ExecuteUpdate();

and I get this exception:

NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type
'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column
29 [insert into UserAudit (Page, [User]) select :page, u.Id from User
u where u.Id = :userId]

column 29 would be at i from insert.

The same query
"insert into UserAudit (Page, [User]) select 'boo', u.Id from Users u
where u.Id = 1"
works when executed in SQL Mgmt Studio.

I tested with a string instead of param :page, but I get the same
exception.

I'm running Antlr 3.1.0 and NH 2.1.2

What it's wrong with it?

Thanks,
Daniel

-- 
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