HiLo ID NHibernate generator does database feedback for every row inserted

When I configure my application to use IdLo Id generation, I see one round per row inserted into the database. All the documentation I read indicated that I should see much less round trips.

My objects are usually configured (fluently) as such:

Id (t => t.Id) .GeneratedBy.HiLo ("MyObject_Identity", "MaxId", "1000");

Also, my batch size is set to mix 75.

I know I am probably doing something relatively stupid.

+2


source to share


1 answer


Do you mean that you see the round trip for each insert to get a new high value for the ID? Should you use a new SessionFactory instance for each operation? SessionFactory is responsible for managing large value retrieval. Typically, you should only have one SessionFactory per application instance (via plain or IoC container).



0


source







All Articles