Ok.You should do by yourself with an explicit Flush because NH is smart
enough to limit RDBMS round-trips.If you like identity so much, you know
that identity mean that the only way to know the ID is hitting DB.
NH need the ID to add the reference to children so he must go to DB but he
can delay the DB hit for each child, if you want a different behavior (each
ID immediately available using identity) you should Flush the session
explicitly.

In any way you can be smart enough and swap your POID generation strategy to
something else to have the best behavior.

2009/3/20 Shane C <[email protected]>

>
> That's correct.  That's how we thought it would work and we coded
> accordingly.  Current fix is to just Flush on SaveOrUpdate.  I can see
> the value of not using identity but it's way past the point where we
> could make that kind of change.
>
> On Mar 20, 3:18 pm, Fabio Maulo <[email protected]> wrote:
> > inpractice you are looking for immediate access to DB for parent and all
> > child right ?
> >
> > 2009/3/20 Shane C <[email protected]>
> >
> >
> >
> >
> >
> > > That seems odd.  I understand the problem but if my FlushMode is set
> > > to Auto, I would think NHibernate would be smart enough to realize
> > > that it needs to Flush to update the relevant Ids?  Identity may not
> > > be the recommend practice but it's very common.
> >
> > > On Mar 20, 1:40 pm, Luke Bakken <[email protected]> wrote:
> > > > I believe it is expected behavior if you're using "identity" as your
> > > > POID generator, but I'm no expert.
> >
> > > > On Fri, Mar 20, 2009 at 12:20 PM, Shane C <[email protected]
> >
> > > wrote:
> >
> > > > > Tracked this down.  The changes are not being flushed so the new ID
> > > > > isn't being retrieved till after our unit of work is completed.  We
> > > > > tried changing FlushMode to Always but didn't see any difference in
> > > > > flushing behavior (The Session had already been used at this point
> so
> > > > > that may have something to do with this?) and instead just had to
> > > > > force a manual flush.  This seems very wrong to me.  Any
> suggestions
> > > > > or thoughts?
> >
> > > > > Thanks,
> >
> > > > > Shane
> >
> > > > > On Mar 20, 1:10 pm, Shane C <[email protected]> wrote:
> > > > >> We've run into a weird problem here.
> >
> > > > >> We have a RuleSet which contains Rules.  In our mapping files
> RuleSets
> > > > >> have a bag of Rules with cascade='all-delete-orphan' and
> > > > >> inverse='true'.  When we add a rule to a ruleset and save the
> ruleset
> > > > >> the ID isn't getting set on the rule.  Is this expected behavior
> or
> > > > >> are we missing something?
> >
> > > > >> Thanks,
> >
> > > > >> Shane
> >
> > --
> > Fabio Maulo
> >
>


-- 
Fabio Maulo

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