ColdFusion lets you use HQL (Hibernate Query Language) to run queries directly on the database. If you are familiar with HQL, you can use it for running complex queries.
In general, use HQL in the following scenarios:
To retrieve entities by specifying a filter that needs to use operators other than AND.
The HQL methods return a single or multi-dimensional array of values or entities, based on what the HQL query returns.
If you are sure that only one record exists that matches this filter criteria , specify unique=trueso that a single entity is returned instead of an array. You can use unique=true to suppress the duplicate records from the query result.
entityname and properties used in HQL are case sensitive.
The following HQL methods are available:
ORMExecuteQuery(hql, [params] [,unique])
ORMExecuteQuery(hql, [,unique] [, queryoptions])
ORMExecuteQuery(hql, params [,unique] [,queryOptions])
ORMExecuteQuery (hql, params, boolean unique, Map queryOptions)