Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 567

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
A one-to-many relationship between two persistent components is defined using the
in the
tag. The source object contains a collection of target objects. ColdFusion allows the collection to
cfproperty
be one of the following types:
• Array
• Struct
This collection is a persistence aware collection. Any addition or deletion from this collection is automatically persisted
in the database.
Array
An Artist object can contain the Art objects as an array. To define this mapping in the CFC, use the following syntax:
Syntax
<cfproperty
name="field_name"
fieldtype="one-to-many"
cfc="Referenced_CFC_name"
linktable="Link table name"
linkcatalog="Catalog for the link table"
linkschema="Schema for the link table"
fkcolumn="Foreign Key column name"
inversejoincolumn="Column name or comma-separated list of primary key columns "
type="array"
orderby="order_by_string"
cascade="cascade_options"
lazy="[true]|false|extra"
fetch="join|[select]"
inverse="true|[false]"
batchsize="N"
optimisticlock="[true]|false"
readonly="true|[false]">
For the artist-art example, the relationship property in Artist.cfc is defined as follows:
<cfproperty name="art" type="array" fieldtype="one-to-many" cfc="Art" fkcolumn="ARTISTID">
specifies that the artist object will contain art objects in an array.
type-array
specifies that the foreign key column is ARTISTID that references the primary key of
fkcolumn="ArtistID"
ARTIST table.
Struct
An Artist object can contain the Art objects as a struct. The key would be any column in the ART table (usually the
primary key or a unique key). The value would be the Art object. To define this mapping, use the following syntax.
Syntax
Last updated 1/20/2012
value
fieldtype
one-to-many
562

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents