Skip to content

NH-3675 - Support Bulk Inserts #912

@nhibernate-bot

Description

@nhibernate-bot

Ricardo Peres created an issue — 25th August 2014, 12:35:25:

Most .NET database providers offer a bulk insertion mechanism (SqlBulkCopy for SQL Server, OracleBulkCopy for Oracle, MySqlBulkLoader for MySQL, etc). It would be interesting if NHibernate could offer support for these. This would have limitations - only "client" id generators would be supported, not identity or sequence or the likes.
Will submit a pull request.


Alexander Zaytsev added a comment — 25th August 2014, 13:37:16:

It is strange that there was no such request ever. Although I do not see any advantages using this or real use cases.


Ricardo Peres added a comment — 25th August 2014, 14:02:09:

I do! I recently had to implement something like this to insert a large volume of records. Yes, I know that NHibernate is not an ETL tool, but still I think it makes sense. I will try to submit a pull request as soon as I'm sure to support all scenarios (inheritance strategies, components, etc) and I'll discuss it in the mailing lists.


Ricardo Peres added a comment — 29th October 2014, 0:55:42:

Pull request: #367.
Has changes in APIs, so needs to be considered only for NH 5.


dzmitry.lahoda added a comment — 10th October 2016, 9:13:52:

Haha!

<VITA(build in) >(https://vita.codeplex.com/wikipage?title=guide_linq&referringTitle=Documentation#updates) and EF(via plugin) both support bulk updates and inserts!

30% of times our project uses SQL is when we want next:

x=> x.State = oldState, x=> x.State = new state

I want to have

update x set state = 'newState' where state = 'oldState'
``

Or next 

()=> new X { Value = 42 } , x=> x.Id, ids)


in basic cases it will translate into many sql inserts, in oracle odp provider into <array binding>(http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59odpnet-085168.html).

Similar for delete!

Please look into VITA documentation of how these features could be powerful. I believe with VITA I may have only 40% of SQL from all queries/updates/deletes/inserts, while with NH we have 80% of SQL.

Not having LINQ update and insert and delete in NH kills NH. 

Please add this feature and donate button into NH pages! 







Frédéric Delaporte added a comment — 13th September 2017, 11:41:55:

Although you (dzmitry) had already commented on it in February 2016, what you are writing about is another feature, NH-3488, which is implemented for NH 5.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions