Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate - ISession vs. IStatelessSession

What is the pros and cons using IStatelessSession over ISession in NHibernate?

like image 544
Fitzchak Yitzchaki Avatar asked Apr 21 '10 00:04

Fitzchak Yitzchaki


1 Answers

StatelessSession doesn't tracks changes made to the entities and has no lazy loading support. Thats why it has a better performance than Session.

But with stateless session you are forced to manage Insert, Delete, Update operations manually and this really uncomfortable.

Stateless session is made for batch operations where you need to make a lots of queries to database and you don't need tracking changes, etc.

like image 165
Sly Avatar answered Sep 23 '22 13:09

Sly