NHibernate - Id generation strategy for importing large amount of data

184 Views Asked by At

I have a database that uses sequence id generators. I need to perform a one time migration of large amount of data. I'm using NHibernate to do the job, because the migration logic is quite complicated.

Also I don't want this operation to last ages, so I would like to make use of batching.

Is there any Id strategy that can use sequence as an input, generate all the needed id's without contacting the database and then update the sequence at the end to enable normal usage by another application?

No other application will be running when the migration is performed.

1

There are 1 best solutions below

3
On

I think HiLo is perfect for your requirement.

You can find HiLo generator documentation here: http://nhibernate.info/doc/nh/en/index.html