Batch insert when using identity generator and stateless sessions? #2662
Unanswered
stucampbell
asked this question in
General
Replies: 2 comments
-
It does sound like you are asking for the stateless session to have state.
That might be one reason not to do it.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Sounds like a case for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
NH disables batching for entities that use an identity generator. I understand why this would be the case for stateful sessions but I'm curious to know why this rule still applies to stateless sessions and why there isn't a way to circumvent the rule.
I have tens of thousands of records to insert and I don't need the the ID values returned, yet each row is being inserted with a roundtrip to the database so that the SCOPE_IDENTITY() is returned.
This is taking minutes to execute. What I'd like to be able to do is to implement a way of forcing batching (regardless of the identity generator) in this particular scenario. Can anyone think of a reason why this would be a bad thing to implement in NH?
Beta Was this translation helpful? Give feedback.
All reactions