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
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 ...