views:

76

answers:

0

I am trying to optimize a particular instance of an owned one-to-many relationship where the parent has a list of children where the list of children could be very large. Children may be created, removed, and edited.

Editing is actually ok as I can retrieve a child without ever retrieving the parent.

For deleting, I could retrieve the parent, remove the child from the parent's child collection, and persist it. However, I would really like to avoid the expense of loading the parent's entire list of children just to delete one child. But if I just delete the child directly, then one what happens to the reference to the deleted child in the List<> that the parent maintains?

As for the creation of a child entity, it really seems that I have no choice but to load the parents entire list of children in order to append the new child.

If I want to avoid loading the parent's list of children in all these situations, are unowned relationships the only way to accomplish it? Does anyone have experience using primarily unowned relationships? Does it hurt?