There is a IOneShotDeleteHandler interface that is apparently for
deleting collections in one shot, hence the name. Instead of NH
issuing delete statement for each item in the collection, one can
implement this interface and than execute delete as one sees fit.
Kinda like cascade deletes, but in NH rather than in db. There was one
post on elegant code about it, but the implementation does not work as
expected for us. It works fine for just one collection, but not for
many. Here is the link
http://elegantcode.com/2009/07/19/nhibernate-2-1-and-collection-event-listeners/

What happens with this implementation is that PreCollectionRemoveEvent
executes OneShotDeleteHandler for each type defined in the
ForChildEntities().

What we need to achieve is following. We have a veryyyyyy deep object
graph, levels upon levels, each containing 100 or more items and we
need to delete a root item. Going through NH with regular removal from
the collections and all-delete-orphan creates 1000's (literally) of
delete statements, locking our whole system, and reducing system
basically to one user system. Dead locks everywhere. To give you more
background (and no, this is not something that I can affect, decision
has been made before), every delete triggers a possibly more triggers
etc, to keep old and new db in synch. Everything goes through views
(inserts,updates, deletes) and so on and so on....

I tried implementing delete listener, gathering all ids and entity
types that I need to delete, and basically executing about 12-15
deletes with IN clause, but I cannot stop NH from generating deletes
too, because of the all-delete-orphan, which we also need. Please
help...



On Sep 19, 8:45 am, Jason Dentler <[email protected]> wrote:
> I don't know what that is either, but I assume you're getting a concurrency
> exception (StaleState or something like that - I forget).
>
> Executable HQL doesn't affect anything in memory. Period. I guess you'll
> need to evict those affected items from the session.
>
>
>
> On Fri, Sep 17, 2010 at 2:37 PM, Fabio Maulo <[email protected]> wrote:
> > What is OneShotDeleteHandler ?
>
> > On Fri, Sep 17, 2010 at 11:46 AM, epitka <[email protected]> wrote:
>
> >> Anybody knows how to suppress NH from issuing deletes of the entities
> >> that I already deleted using HQL delete query in OneShotDeleteHandler?
>
> >> --
> >> 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]<nhusers%[email protected]
> >>  >
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > Fabio Maulo
>
> >  --
> > 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]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

-- 
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.

Reply via email to