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

Criteria queries

NHibernate defines an alternative API that we can use to query our data from the database. These kinds of queries are called criteria queries. The queries are created by composing a set of criteria. Different types of criteria exist for filtering, sorting, projecting (or mapping), as well as grouping sets of records. In the past, it was only possible to define queries using magic strings. With the introduction of NHibernate 3, it is also possible to define strongly-typed criteria queries.

Untyped criteria queries

In this section, we shall see how we can create criteria queries that result in the same set of records as in the examples used when we discussed the LINQ to NHibernate provider.

All of it starts by defining the root of ...

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