I am using NHibernate 2.1.0.4000 in one of the projects. I have set adonet.batch_size to 100 in the cfg file however I still see that insert statement is treated as single statement. Update seems to work fine. What's going on?
Updated: Is it because I've chosen identity as the primary key generator?
<id name="Id" column="Id" unsaved-value="0" type="Int32">
<generator class ="identity"></generator>
</id>
I don't know of any issues with that particular NHibernate version.
Are your using
native
as the ID generator for your entities? Because this will force every insert to happen alone, selecting back the generated ID. This is because the database needs to generate every ID. This would also explain why batching seems to work on updates.If possible, you should switch to e.g. the
hilo
strategy, or evenguid
if you don't care about (easily) readable IDs.Fabio has han interesting post here regarding this topic.