Summary

There are multitude of different ways of retrieving data in NHibernate. These can be mainly divided into two types. First type consists of ISession.Get<T> and ISession.Load<T>, which you can use when you know the id of the entity you want to retrieve. Both of these can be the fastest ways of retrieving an entity from database. These are used by NHibernate internally. Second type of data retrieval methods in NHibernate are geared towards complex situations that go beyond loading entities by their id. HQL, Criteria API, QueryOver, and LINQ, all let you write complex queries in an intuitive way using object-oriented APIs. These let you load entities by properties other than ID or even combination of properties, join two or more entities, ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.