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

Hibernate Query Language

This is the original query language of NHibernate. It strongly resembles SQL, but is more object-oriented than its counterpart. HQL queries are defined as strings, and thus are not type-safe. On the other hand, and on a positive note, HQL gives support to dynamic entities for which a class does not exist at all.

Parameters in HQL queries are defined by prefixing a name with a colon, for example:name.

In this section, we will see how to write HQL queries that are equivalent to the queries introduced in the section The LINQ to NHibernate provider. Each HQL query is created by calling the CreateQuery method of the ISession interface and passing the HQL string as a parameter. To query a list of all products, one would write ...

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