O'Reilly logo

Learning NHibernate 4 by Suhas Chatekar

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

Lazy loading

In the beginning of the chapter we saw that when the Employee entity was loaded, NHibernate did not load the associated collection entities such as Benefits and Communities. That is default behavior of NHibernate. At first it may sound strange, but think what would happen if NHibernate tried loading Benefits and Communities along with the Employee entity. Each Community instance in the Communities collection has collection of the Employee instances associated with it. NHibernate will need to load all those Employee instances. Each of those Employee instances will have further Community instances to load. This cycle will only stop when the entire database is loaded into memory. To avoid situations like this, NHibernate only loads 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