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

The session factory

NHibernate uses a factory object to create new session instances. This factory object is called a session factory. One single session factory object can create as many session objects as desired. The creation of a new session object is a very cheap operation.

On the other hand, the creation of a session factory is very expensive. Depending on the complexity of the system, it can take a considerable amount of time to create a session factory instance. This is the reason why we should only create the session factory once during the whole lifetime of an application.

A session factory is specific to a database. If our application only needs or communicates with a single database, then we need only one session factory. If, on the ...

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