Ok, all my collections are mapped as bags with <bag lazy="true" access="field.camelcase" cascade="all-delete-orphan" inverse="true" batch-size="30">
The documentation however states "Of course, one-shot-delete does not apply to collections mapped inverse=true" Could this be why my deletes aren't doing a one-shot-delete? Do I really need inverse="true"? On Nov 12, 9:00 am, Paladin_za <[EMAIL PROTECTED]> wrote: > My mappings already have cascade defined as cascade="all-delete- > orphan". > > Is there a way to go and eagerly fetch a portion of a branch and > attach it to an object instance? > > On Nov 12, 7:48 am, "Anne Epstein" <[EMAIL PROTECTED]> wrote: > > > I might be misunderstanding your question (if so I do apologize) but > > could nhibernate's cascade delete functionality work for you? > > all-delete-orphan may very well be what you want if the children are > > truly dependent, and so would need to be removed with the parent. > > With your cascades set, nHibernate should transparently and cleanly > > handle deleting what needs to be deleted. > > >http://nhforge.org/doc/nh/en/#example-parentchild-cascades > > > On Tue, Nov 11, 2008 at 11:33 PM, Paladin_za <[EMAIL PROTECTED]> wrote: > > > > Hi All > > > > I need to optimize a process that potentially needs to delete > > > instances consisting of a deep and complex object graph. > > > > My first solution was to greedy load the whole complex object graph > > > and then delete the instances that needed to be deleted. > > > The problem with this method is that loading the complete object graph > > > takes too long (its complex with a lot of data) > > > I don't always need to delete objects. > > > > My second solution is to load only what I need at startup and then > > > when an instance needs to be deleted the ORM lazily loads the needed > > > child data necessary to perform the delete. > > > This will run slower, but only in the cases when a delete is required > > > (which is rare). > > > > A third solution would be to find all the objects that need to be > > > deleted and then greedily load only their info. My problem is I don't > > > know how to approach this. At the moment I use the session to retrieve > > > my base instance. Can I just do a query on the session and NHibernate > > > will "magically" attach the child objects to my existing instance? > > > > Any ideas. > > > > Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
