Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 585

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
: Specifies the timeout value (in seconds) for the query.
timeout
and
Maxresults
timeout
Example
To load first 5 artists whose state is "CA" that are sorted on the firstName.
<cfset artists = EntityLoad("Artist",{state='CA"}, "FirstName", {maxResults=5})>
EntityLoadByExample(sampleentity [,unique])
Loads and returns an array of objects that match the
all the non-null properties of the
values:
<cfset artist= CreateObject("component", "artist")>
<cfset artist.setState("CA")>
<cfset artist.setCity("Berkeley")>
<cfset artist=EntityLoadByExample(artist)>
If you are sure that only one record exists that matches the specified
so that a single entity is returned instead of an array. If
unique=true
returned, then an exception occurs.
EntityReload(entity)
Reloads data for an entity that is already loaded in this session. This method refetches data from the database and
repopulates the entity.
Delete objects
EntityDelete
This method deletes the record from the database for the specified entity. Depending on the cascade attribute specified
in the mapping, it also deletes the associated objects.
Syntax
EntityDelete(entity)
Example
For example, to delete an Artist with ArtistID 5:
<cfset artist = EntityLoad('artist', 5, true)>
<cfset EntityDelete(artist)>
Convert object to query
This method converts the input entity object or the input array of entity objects to a query object. The
EntitytoQuery
name of the properties are used as the query column names. Use the optional parameter
query of the given entity in the case of inheritance mapping. All the objects in the input array should be of the same
type. Relationship properties are not be included in the result query.
Syntax
EntitytoQuery (orm_object, [entity_name])
EntitytoQuery (orm_object_array, [entity_name])
are used for pagination.
sampleentity
.For example, to retrieve an array of objects matching the specified
sampleentity
Last updated 1/20/2012
. The filter criteria is constructed by ANDing
, you can specify
filtercriteria
and multiple records are
unique=true
Entity_name
580
to return the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents