Chapter 7. Retrieving objects efficiently

This chapter covers

  • NHibernate query features
  • HQL, criteria, and native SQL
  • Advanced, reporting, and dynamic queries
  • Runtime fetching and query optimization

Queries are the most interesting part of writing good data access code. A complex query may require a long time to get right, and its impact on the performance of an application can be tremendous. As with regular SQL, writing NHibernate queries becomes much easier with experience.

If you’ve been using handwritten SQL for a number of years, you may be concerned that ORM will take away some of the expressiveness and flexibility you’re used to. This is seldom the case; NHibernate’s powerful query facilities allow you to do almost anything you ...

Get NHibernate in Action 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.