The behavior sounds correct to me. NH follows the object graph when doing inserts, it can't guess the "best" order for your particular use case.
Diego On Mon, Feb 1, 2010 at 23:38, Eduardo Scoz <[email protected]> wrote: > I'm trying to find more information about how nHibernate decides how > to batch multiple inserts together. Apparently it just works if you > have a simple list of objects of the same type, with no children > objects. > > In my application, I have a one-to-many relation between three tables > A, B, and C: A has many B, B has many C. I'm using a native generator > for A's Id, but for B and C I'm just using composite-keys, which are > assigned in the code, so that nHibernate can only do inserts. These > seem to be working fine, and I can get all the objects saved properly. > > The problem is that nHibernate doesn't seem to be smart enough to try > to first insert all objects of type A in batch, then all B in batch, > and finally all C in batch. Right now, it tries to batch only the > objects of type C, if there are multiple. > > Does this sound correct? Is there any way to change this behavior? > > My application needs to add hundreds of objects of types A,B and C at > the same time, and having to do one by one is a big performance > problem. > > -- > 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.
