How to delete multiple db entities with Nhibernate?

I had problems getting the answer to work and I found the following query worked 100%

        Session.CreateQuery("delete Customer c where c.id in (:deleteIds)")
            .SetParameterList("deleteIds", deleteIds)
            .ExecuteUpdate();

Customer is the class name not the table name. id is lowercase and in HQL it is the Primary Key not a property name in the class (Property names are supported)


HQL supports the IN clause, and if you use setParameterList you can even pass in a collection.

var idList = new List<int>() { 5,3,6,7 };

_session.CreateQuery("DELETE MyDataClass o WHERE o.Id IN (:idList)")
    .SetParameterList("idList", idList)
    .ExecuteUpdate();

Be aware, like mentioned by ddango in a comment, that relationship cascades specified in your objects will not be executed since running an HQL query simply translates to a DB query and does not actually load any entity objects.