Yeah, that is what I am trying to do, although in a more generic way. I just tried it on a project with NH 2.1.0.4000 and it worked great. Guess I need to upgrade NH on this project.
Joe On Sep 24, 1:34 pm, cws <[email protected]> wrote: > Hi! > > Are you trying to achieve this? > > http://fabiomaulo.blogspot.com/2009/05/nh21-executable-hql.html > > On Sep 24, 8:07 pm, Joe <[email protected]> wrote: > > > How do you perform a batch delete with HQL? > > > I am trying to execute one and keep getting the following exception. > > > NHibernate.QueryException: query must begin with SELECT or FROM: > > delete [delete QuestionnaireEntity] > > > The calling code is: > > public void DeleteAll<T>() > > { > > using (var session = sessionManager.OpenSession()) > > { > > var sql = "delete " + typeof (T).Name; > > > var query = session.CreateQuery(sql); > > > query.ExecuteUpdate(); > > } > > } > > > I am using NHibernate 2.1.0.1000 > > > I have tried "delete from" and get the same exception. > > > Thanks, > > Joe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
