I have adonet.batch_size set to 10, but when I do a save on an object graph, it will save the object and all it's children in a separate database call.
I am able to see this using the NHProf tool.
-- statement #1
INSERT INTO Preferences
-- statement #2
INSERT INTO PreferencesToWidgets
-- statement #3
INSERT INTO PreferencesToWidgets
-- statement #4
INSERT INTO PreferencesToWidgets
-- statement #5
INSERT INTO PreferencesToWidgets
-- statement #6
INSERT INTO PreferencesToWidgets
-- statement #7
INSERT INTO PreferencesToWidgets
-- statement #8
INSERT INTO PreferencesToWidgets
-- statement #9
INSERT INTO PreferencesToWidgets
-- statement #10
INSERT INTO PreferencesToWidgets
-- statement #11
INSERT INTO PreferencesToWidgets
-- statement #12
INSERT INTO Users
Users is one-to-many to Preferences
Preference is many-to-one to PreferencesToWidgets
Basically, I have a user that I add a preference to, and that preference has a bunch of preference-to-widgets added to it.
I then call session.SaveOrUpdate( user ), and all the objects are inserted in separate calls, even though the batch size is set to 10.
I am doing the configuration via FluentNHibernate.
Fluently.Configure() .Database(FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey( connectionStringKey ) ) .ProxyFactoryFactory( "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu" ) ) .Mappings( m => m.FluentMappings.AddFromAssembly( typeof( SessionFactoryFactory ).Assembly ) ) .ExposeConfiguration( cfg => cfg.SetProperty( "generate_statistics", "true" ) ) .ExposeConfiguration( cfg => cfg.SetProperty( "adonet.batch_size", "10" ) ) .BuildSessionFactory();