<< delete one child from my parent by calling remove
on the childs list>>

cascade="all_delete_orphan"

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Niclas Pehrsson
Sent: den 14 maj 2009 11:08
To: nhusers
Subject: [nhusers] Parent Child problem


Hi I earlier posted this post: 
http://groups.google.com/group/nhusers/browse_thread/thread/b06317e4d6b8a1e0#

The post was about a parent child scenario where I didn't want the
child to know about its parent.
The problem were that I got 2 calls to the DB for each child row, one
Insert, and then one Update.

I solved this by adding a many-to-one reference in the child mapping
with not-null=true and inverse=true on the parent.

Now Im facing the problem that when I delete a child from my parent it
will not being deleted, so how can I solve this?

I want to be able to save my parent, with its childs with only inserts
no updates.
I want to be able to delete one child from my parent by calling remove
on the childs list and then when I make Save on the parent the childs
will be removed.

Can I make it happen? Or should I just ignore the updates for each
child?
Im not only thinking performance in the two sql queries being executed
for each child, im thinking that it would be harder to make something
going wrong in the database if I keep the columns where I allow null's
at a low level.



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