I need to insert 1 million of object in an oracle database, right now it takes so much time to do this job, how can i insert faster this object inside the database?
I’m using this code to do it:
using (ISession session = NHibernateHelper.OpenSession())
{
using (ITransaction tranx = session.BeginTransaction())
{
session.Save(movimientoPendiente);
tranx.Commit();
}
}
Thanks for your help.
Use a single session instead of creating a new connection to the database for each of your records. Jimmy Bogard wrote a good blog post about bulk processing using NHibernate.