Whatever message this page gives is out now! Go check it out!

Use HQL queries

Last update:
May 18, 2026
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:
  • The query is not specific to a particular object but only to some fields in the object.
  • To retrieve some fields of the object without loading the object.
  • When you use table joins.
  • When you use aggregate functions like min, max, avg, and count.
  • 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.
Note:
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)

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page