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

Unit of Work

When we load objects from the database and change them, it is important to keep track of what we have changed; otherwise, the changed objects won't be written to the database. Furthermore, new objects have to be added to the database and objects we delete have to be removed from the database.

A Unit of Work (UoW) is used to keep track of everything that happens during a business transaction and that affects the database. It keeps track of every single step needed to update the database once the business transaction is completed. The UoW guarantees that the individual database operations needed to update the system are executed in the right order, to avoid any database constraint violations.

In NHibernate, we have the Session object, ...

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