>
> public void SaveEntries(IEnumerable<MasterFileEntry> entries)
{
var sessionFactory = ((SessionManager)
SessionManager).SessionFactory;
> var session = sessionFactory.OpenSession();
global::NHibernate.Context.CurrentSessionContext.Bind(session);
> var transaction = session.BeginTransaction();
> try
{
foreach (var entry in entries)
session.Save(entry);
> transaction.Commit();
}
catch (Exception)
{
transaction.Rollback();
throw;
}
finally
{
>
> global::NHibernate.Context.CurrentSessionContext.Unbind(session.SessionFactory);
session.Dispose();
}
}
Do you know what you are doing here?
Why do you bind and unbind the new session in the same method?
You don't need bind and unbind, probabily you have flush after you commit
the transaction. Try calling session.Flush() before commit
And if you have to do a bulk insert try with stateless session.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.