0

I wish to know if there is way to evict/clear the session even thogh Im using SQLite.

I have a lot of data that i want to save, and commit all in one transaction. I use session.flush() and then session.evict() after every save, but the ram still raise and there is overflow.

Any ideas ? Thanks a lot.

Or Cohen
  • 13
  • 3

2 Answers2

0

You require Session.Clear() before Session.Abandon because of following reason

Session.Clear() will CLEAR the values of all the keys but will NOT cause the session end event to fire.

Session.Abandon() will NOT clear the values on the current request. IF another page is requested, the values will be gone for that one. However, abandon WILL throw the event.

It would be better to use Session.Clear() rather than using Session.Abandon() because the values still exist in session after calling Session.Abandon() but are removed after calling the Session.Clear() .

Neel
  • 11,625
  • 3
  • 43
  • 61
  • Im not using asp, the session is an isession object so i do not have abandon function. Im also do need to erase everything from the session to prevent the memory ezxception. – Or Cohen Jan 29 '15 at 12:29
  • will it help? http://stackoverflow.com/questions/189280/problem-using-sqlite-memory-with-nhibernate @OrCohen – Neel Jan 29 '15 at 12:38
  • How this article can help me exectly ? – Or Cohen Jan 29 '15 at 12:52
0

You should be using IStatelessSession when inserting a large number of records.

Dmitry S.
  • 8,373
  • 2
  • 39
  • 49