You say that both sides are mapped but I don't see the reference from Vehile
to Person.
Once you have that, setting Inverse and Cascade All on the Person side
should do the trick.

   Diego


On Fri, Jan 22, 2010 at 21:57, Eric J. Peters <[email protected]> wrote:

>
> Hi-
>
> I'm sure this is a totally rookie question, but I'm not finding the
> answer anywhere.
>
> I have an entity with a child collection of other entites, something
> like this:
>
> public class Person
> {
>    int? Id { get; set; }
>    string Name { get; set; }
>    IList<Vehicle> Vehicles { get; set; }
> }
>
> public class Vehicle
> {
>    int? Id { get; set; }
>    string Name { get; set; }
> }
>
> Both sides are mapped (using Fluent NHibernate) as a Reference/HasMany
> relationship.
>
> The problem is that when I create an new Person with some new
> Vehicles, the save isn't cascading to the Vehicles.  If I save the
> vehicles first, then apply them to the new Person, it works fine, but
> I really want to avoid the extra step of explicitly creating/saving
> the Vehicles first.
>
> It seems that this should be something easily achievable with
> NHibernate, but I'm not finding the magic handshake.  Can anybody
> provide me some advice on how to make these objects work as I'm
> hoping?
>
> Thanks!
> -Eric.
>
> --
> 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]<nhusers%[email protected]>
> .
> 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 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