I guess I spoke too soon.  I actually just changed the problem.  Now I
receive a "Row was updated or deleted by another transaction (or
unsaved-value mapping was incorrect):" exception.  And when I watch
what NH is doing via NHProfiler I get very confused.  I see a bunch of
inserts as I would expect but then I see an Update occurring.  This is
weird because..

1. I have identified unsaved-value properly
2. It's updating something that has never been inserted (and for whom
it has never even done a select statement)

One thing I should note is that we have Versioning turned on and when
it does the Update it sets Version = 2 and does a WHERE Version =
1...

Any suggestions would be greatly appreciated...

On May 25, 10:30 am, Shane C <[email protected]> wrote:
> I think I've got it figured out.  An unsaved-id wasn't configured
> properly so when the Animal was the aggregate root it worked because
> we saved it directly.  Now that it's no longer the root NH needs to
> know the unsaved-id.  Makes perfect sense :)
>
> And thanks for the error message which pointed out the exact
> problem :)
>
> On May 25, 10:20 am, Shane C <[email protected]> wrote:
>
> > We are making changes to our model and have ran into an issue with the
> > way a foreign key is being populated.  We use to have...
>
> > Animal instance
> >   has a bag of StateChange instances (Birth, Death)
>
> > This worked great for awhile but we had to add another layer to that
> > and now have...
>
> > AnimalSeries instance
> >    has a bag of Animal instances
> >       has a bag of StateChange instances
>
> > The problem is that when we try and save an AnimalSeries we run into a
> > foreign-key violation.  StateChange has a field called ANIMAL_ID which
> > has a foreign-key to the Animal instance but it's being populated with
> > a 0.
>
> > This to me almost sounds like the normal "NH doesn't persist
> > collections nicely" problem but my question is why did this work fine
> > before we added the additional layer?
>
> > Thanks,
>
> > Shane
>
>
--~--~---------~--~----~------------~-------~--~----~
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