Hi all,
I'm doing a mass save operation and NHProf is suggesting that I use
batching to help things along. I have adonet.batch_size set in my
config file and I'm also trying to set the batch size at runtime, but
NH doesn't seem to be picking up those values. Each save command is
still processed individually.
I've tried the following, with no success:
using (var transaction = Session.BeginTransaction()) {
Session.SetBatchSize(itemsToSave.Count);
foreach (var item in itemsToSave)
Session.SaveOrUpdate(item);
Session.SetBatchSize(0);
transaction.Commit();
}
I've also tried the following with no luck:
using (var transaction = Session.BeginTransaction()) {
Session.SetBatchSize(itemsToSave.Count);
foreach (var item in itemsToSave)
Session.SaveOrUpdate(item);
transaction.Commit();
}
Session.SetBatchSize(0);
My configuration file looks like:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="MyProject">
<property name="dialect">MsSql2008Dialect</property>
<property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
<property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</
property>
<property name="adonet.batch_size">16</property>
<property name="generate_statistics">true</property>
<property name="current_session_context_class">web</property>
<property
name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle</property>
<mapping assembly="MyProject.Domain"/>
<listener class="MyProject.Domain.SaveEventListener,
MyProject.Domain" type="save" />
<listener class="MyProject.Domain.SaveEventListener,
MyProject.Domain" type="save-update" />
</session-factory>
</hibernate-configuration>
What am I doing wrong?
Thanks,
Jim
--
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.