To group all DELETE statements in a single one

Description

Let's consider the following :

class A{

IList<B> myChildren;

}

class B {

}

int Id = 5;
A myEntity = session.getById<A> (Id);

A.myChildren.clear();

session.SaveOrUpdate(A);

If there were 3 children in the collections, the sql generated is:

DELETE FROM TABLE_A WHERE CHILDREN_ID = 1
DELETE FROM TABLE_A WHERE CHILDREN_ID = 2
DELETE FROM TABLE_A WHERE CHILDREN_ID = 3

When what I would like NH to do is :

DELETE FROM TABLE_A WHERE CHILDREN_ID IN (1, 2, 3)

Can this be done ?

Environment

None

Assignee

Alex Zaytsev

Reporter

Samuel Berthelot

Components

Affects versions

Priority

Minor
Configure