public void inserts_are_batched() { using (var session = SessionFactory.OpenStatelessSession()) using (var transaction = session.BeginTransaction()) { session.SetBatchSize(2); var builder = new ProductBuilder(); session.Insert(builder.Build()); session.Insert(builder.Build()); Logger.Info("the first batch of 2 inserts has been sent to the database now"); session.Insert(builder.Build()); session.Insert(builder.Build()); Logger.Info("the second batch of 2 inserts has been sent to the database now, without flushing the session"); transaction.Commit(); } }