tags:

views:

41

answers:

1

We have a database that is updated via a background process. We are using NHibernate to query the data for display on the web UI, so we don't need change tracking or lazy-loading.

If we mark all the mappings as mutable="false", is this the same as using a stateless session?

+2  A: 

No, it's not the same. In fact, it has absolutely nothing to do with it (i.e. you can modify entities in stateless sessions).

A StatelessSession does not keep track of entities, which results in big performance improvements (both in memory usage and execution times) when you don't need the features that a stateful session provides.

In particular:

  • There is no lazy loading
  • There is no caching
  • There is no cascading
  • All updates must be explicit (insert/update/delete)
Diego Mijelshon
But does marking mutable="false" mean the entity will not be tracked?
JontyMC
No, it doesn't. It only means it will not be *updated* once it's persistant, but that's just a flag; all the plumbing is still there.
Diego Mijelshon