Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the business of Session.Clear() in NHibernate?

Tags:

nhibernate

What does Session.Clear() do in NHibernate? I mean, what is the meaning of Clear in session?

like image 761
NetSide Avatar asked Aug 13 '10 13:08

NetSide


People also ask

What is session in NHibernate?

The NHibernate session encapsulates a unit of work as specified by the unit of work pattern.

What does NHibernate flush do?

An nHibernate session maintains all changes to the object model. At some point, it needs to synchronize these changes with the database.

What is fetch in NHibernate?

A fetching strategy is the strategy NHibernate will use for retrieving associated objects if the application needs to navigate the association. Fetch strategies may be declared in the O/R mapping metadata, or overridden by a particular HQL or Criteria query.


1 Answers

  • It will clear the unit of work (if you have unflushed changes, they will be discarded)
  • It will remove all current entities in the session from the identity map, in effect it will be as if you called session.Evict on all instances loaded through this session.

Not sure what else.

like image 66
Torkel Avatar answered Oct 20 '22 21:10

Torkel