I have an object with a cascaded list which is mapped in the following way:
HasMany(x => x.Products).Cascade.AllDeleteOrphan(); //.BatchSize(10000);
After adding 20000 products to the list, the commit takes more then 30 seconds (while it should be max 3 seconds).
What I need is a kind of bulk insert. I could follow this approach: Speed up bulk insert operations with NHibernate. I know this solution uses the StatelessSession
but anyway, my hope is to configure these things in my mapping, adding objects directly to the list in my Entity
and NHibernate
takes care of the remaining stuff. Setting the BatchSize
on the mapping of the list seems to has no effect.
Is there any way to accomplish this task in an acceptable time?