AFAIK this cannot be done. The reason for that is pretty simple as alot of relations are not managed via the database but by nhibernate mappings. NHibernate needs to fetch these records first to also remove possible other relations and update read-only fields with updated data. This cannot be done if you do a pure database delete. This model will always result in NHibernate deleting records by their primary key and that it will also know exactly how many rows will be deleted.
You want to delete zero or more records with a where query. If you want to do that then just create a sql query for that if you know that all relations to/from those records are maintained by foreignkey relations with cascading deletes for example and that you know that you do not have any read only properties that need to be updated. Just do your bulk operations seperate from NHibernate but make sure that when you do such operations that your 2nd level cache could (partially) be invalidated. -- Ramon On Sun, Sep 18, 2011 at 3:08 PM, Bruce Meacham <[email protected]> wrote: > Using NHibernate, is there a way to do INSERT INTO SELECT and/or > DELETE FROM WHERE without actually returning anything to the calling > objects? I want to use these operation several times on intermediary > results, then fetch the final smaller result. The application is very > very large and this is the best way to solve it. > > Any ideas? > > -- > 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. > > -- Ramon -- 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.
