Is it possible to execute a normal SQL delete statement?
I have 3 tables:
Sheet,
Operation
and OperationSheet which is used for a many-to-many association between the two tables and contains the 2 id's.
The many-to-many association is only visible in the Operation mapping:
Code:
<bag name="Sheetlist" table="OperationSheet" lazy="false" >
<key column="OperationID"></key>
<many-to-many class="Plan.Sheet, Plan" column="SheetID"/>
</bag>
Now I want to delete all the sheets that have no connection to the operation table, in SQL (sql server 2005) my statement would be something like this:
Code:
DELETE From Sheet WHERE Sheet.SheetID IN(
SELECT Sheet.SheetID FROM Sheet LEFT OUTER JOIN
OperationSheet on
Sheet.SheetID = OperationSheet.SheetID
WHERE OperationSheet.SheetID IS NULL)
Is it possible to execute this statement with NHibernate or are there alternatives which have the same result?