ORMExecuteQuery

Note: This function has been enhanced in ColdFusion 9.0.1 to support multiple data sources in the same application. Install the ColdFusion 9 update to use the feature.

Description

Executes a Hibernate Query Language (HQL) query.

By default, this function works on ORM's default data source. To use this function for another data source, specify the data source key-value pair within the queryoptions.

Syntax

ORMExecuteQuery(hql, [params] [,unique]) ORMExecuteQuery(hql, [,unique] [, queryoptions]) ORMExecuteQuery(hql, params [,unique] [,queryOptions])

Parameters

Parameter

Description

Hql

The HQL query that has to be executed.

Params

Object parameter for the entity.

Unique

Specifies if the object parameter is unique.

Queryoptions

Key-value pair of options for the query.

Example

<cfset artistArr = ORMExecuteQuery("from Artists where artistid=1", true, {datasource="cfartgallery"})> 
<cfset countArray = ORMExecuteQuery("select count(*) from Authors", [], false, {datasource="cfbookclub"})>