O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

First level cache or identity map

To achieve better performance, NHibernate intelligently caches data. There are different caching mechanisms in play. The most important one is the first level cache. Each session object maintains such a first level cache. The cache is created when the session object is created and is destroyed when the session object is disposed.

A cache is nothing else but a hashtable. A hashtable stores values by a unique key. A value can be retrieved very efficiently by knowing its key.

NHibernate deals with entities. We have learned what entities are in Chapter 3, when we talked about the model. An entity is uniquely identified by its ID. We have mentioned that two entities are equal if they are of the same type and their IDs ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required