Mare,
I've just made a small example with two tables - Orders and OrderDetails. Orders has a Set of OrderDetails, and OrderDetails has a many-to-one element associated with Orders table. All fields don't allow nulls.
Everything works OK - I load Orders entity, remove one OrderDetails element from Orders' Set and NHibernate produces only one Delete Sql command. The OrderDetails Set defined in HBM for Orders entity has cascade="all-delete-orphan" so maybe check the value in the cascade tag.
If this wouldn't help please post both HBM files. Here are HBM files for the example described above:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="OrdersEntity, Aaa.Server.Data" table="Orders">
<id name="Id" column="IdOrder" type="System.Int32"unsaved-value="null"><generator class="native"/></id>
<property name="Name" column="Name" type="System.String" not-null="true" length="50"/>
<set name="OrderDetailsSet"
cascade="all-delete-orphan"
inverse="true"
lazy="true">
<key column="IdOrder"/>
<one-to-many class="OrderDetailsEntity, Aaa.Server.Data"/>
</set>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="OrderDetailsEntity, Aaa.Server.Data" table="OrderDetails">
<id name="Id" column="IdOrderDetail" type="System.Int32" unsaved-value="null"><generator class="native"/></id>
<property name="Amount" column="Amount" type="System.Double" not-null="true" />
<many-to-one name="Order" column="IdOrder" not-null="true" outer-join="auto"></many-to-one>
</class>
</hibernate-mapping>