You can't let the db do the work for you?
http://www.hibernate.org/hib_docs/reference/en/html/mapping.html
5.1.21 - on-delete="cascade"


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Paladin_za
Sent: den 12 november 2008 06:34
To: nhusers
Subject: [nhusers] Optimisation Question


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

Reply via email to