IsOrderUpdatesEnabled on the Settings class

15 views
Skip to first unread message

grae123

unread,
Apr 30, 2015, 10:19:25 PM4/30/15
to nhu...@googlegroups.com
Hi,

I have noticed that NH doesn't batch up updates as effectively as it could (and does on inserts). Specifically when the entity graph hits a level such as "parent -> child collection -> child", NHibernate will issue updates like:
  Parent 1
    -> Batch updates on Parent 1's children
    -> Batch updates on Parent 1's children children
  Parent 2
    -> Batch updates on Parent 2's children
    -> Batch updates on Parent 2's  children children
  Parent 3
    -> Batch updates on Parent 3's children
    -> Batch updates on Parent 3's  children children


The system I am currently working on ends up performing actions on multiple items (for example pricing 50 pieces of stock), which can result  in 100 queries to the database.
Without wanting to argue the use of nhibernate for this kind of operation, I have noticed a property called "IsOrderUpdatesEnabled" on the session class which is never set. Altering the configuration classes to allow this to be set results in a big improvement with batching such operations. The updates now issue like:

  Batch updates on all Parents
  Batch updates on all Parent's children
  Batch updates on all Parent's childrens children

i.e. 3 queries instead of, in this scenario with 3 top level entities, 9.

My question is, is there a reason why this property is not set from the SettingsFactory class, and if not, would anyone be interested in a PR to allow it to be set? Or have I overlooked some way to set it!

I haven't come across any issues when running locally with it switched on.

Thanks,

Graeme

Ricardo Peres

unread,
May 1, 2015, 2:59:39 AM5/1/15
to nhu...@googlegroups.com
Can you submit a pull request?

RP

Graeme Foster

unread,
May 1, 2015, 3:08:44 AM5/1/15
to nhu...@googlegroups.com
On 1 May 2015 at 14:59, Ricardo Peres <rjp...@gmail.com> wrote:
Can you submit a pull request?

RP

--
You received this message because you are subscribed to a topic in the Google Groups "nhusers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nhusers/Fgt6RTdsDn8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nhusers+u...@googlegroups.com.
To post to this group, send email to nhu...@googlegroups.com.
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages