EntityLoad with entityname, filtercriteria, and sortorder

Description

Loads and returns an array of entities that satisfy the filtercriteria that is sorted as specified by the sortorder parameter.

Returns

Array (by default)

Category

ORM functions

Function Syntax

entityload(entityname, filtercriteria, sortorder [, options])

Parameters

Parameter

Description

entity name

Name of the entity to be loaded.

filtercriteria

Key-value pair (ColdFusion Struct) of property names and values. If there are more than one key-value pair, then the AND operator is used.

sortorder [, options]

String used to specify the sortorder of the entities.

Usage

Options available with the sortorder parameter are:

  • ignorecase: Ignores the case of sort order when set to “true”. Use this option only when you specify the sortorder parameter.

  • max_Results: Specifies the maximum number of objects to be retrieved.

  • max_Results: Specifies the maximum number of objects to be retrieved.

  • cacheable: Whether the result of this query is to be cached in the secondary cache. Default is false.

  • cachename: Name of the cache in secondary cache.

  • timeout: Specifies the timeout value (in seconds) for the query.

Note: Maxresults and timeout are used for pagination.

Examples

To retrieve objects whose country is UK, and sorted by Department ascending and Age descending:

<cfset employeesInUKSorted = EntityLoad('employee', 
{country="UK"}, "Department Asc, Age Desc")>