That worked and is certainly better than reading the database again, I was 
just hoping there was a way to do it thru the mapping.  i.e. something like 
exlicit if parent was null but id was not, and implicit if parent was not 
null.
 
Thanks,
 
Keith

On Friday, September 7, 2012 8:06:18 AM UTC-4, Oskar Berggren wrote:

> I haven't used RIA, but on the NHibernate side you can use 
> session.Load(parentId) to get a proxy for the parent without reading from 
> the DB.
>
> /Oskar
>
>
> 2012/9/6 kpfishon <[email protected] <javascript:>>
>
>> I have a parent child object graph that is constructed on the client, 
>> since I am using RIA WPF when the SubmitChanges is called only the new or 
>> modified objects are sent to the server.  If both the parent and child are 
>> new, then References(x => x.Parent, "ParentId").Fetch.Join().Cascade.All(); 
>> updates the ParentId column on the child.
>>  
>> If the child is new, but the parent exists, then RIA does not send the 
>> parent to the server as part of the object graph, it sets the ParentId on 
>> the child object and leaves the Parent object null.
>>  
>> When the child is saved to the DB, the ParentId does not persist.  I was 
>> able to work around this by completing the object graph on the sever using 
>> the ParentId that was set on the child.  Then when the child was saved, it 
>> would properly update the ParentId column.
>>  
>> Is there another way to have nhibernate map the column if the ParentId is 
>> set but the Parent is not?  This would avoid having to read the parent 
>> record.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/nhusers/-/-j-xBzbJOW4J.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> [email protected] <javascript:>.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/-l-WYYMgIkUJ.
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