This post is about an old missed feature in NHibernate batching. I have mentioned this feature in this post but again I forgot it. How old is it ? what about 2007-09-15 ? yes, so old.
The little test
With NHibernate 3.1, and before, giving a batch-size set to 10 we have 26 roundtrips because, in practice, due to cascade the batcher is used only to insert memberships; we have 12 roundtrips to store users, 12 roundtrips to store groups and only 2 roundtrips to store memberships.
With NHibernate 3.2, and above, giving a batch-size set to 10 we have 6 roundtrips; 2 roundtrips to store the 12 users, 2 roundtrips to store the 12 groups and 2 roundtrips to store the 12 memberships.
Starting with NHibernate 3.2 the new behavior is by default.