Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 570

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
<cfproperty
name="fieldname"
fieldtype="many-to-many"
cfc="fully qualified 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 a composite key with comma-separated primary key columns"
mappedby="Property in the target component that is referenced by fkcolumn in join table"
type="[array]|struct"
orderby="order by String
structkeycolumn="The structure key column name"
structkeydatatype="datatype".
cascade="cascade options" inverse="true|[false]" lazy = "[true]|false" [optional]
fetch="join|[select]" [optional] batchsize="integer" optimisticlock="[true]|false"
readonly="true|[false]"
missingrowIgnored="true|[false]">
For the Order-Product example, the many-to-many relationship is established using a third table "OrderProduct" that
has two foreign keys: OrderId and ProductId. OrderId references the primary key orderId in the order table, and
ProductId references the primary key productId in the Product table. This relationship can be defined as follows:
• Order.cfc
<cfproperty
name="products"
fieldtype="many-to-many"
CFC="Product"
linktable="Order_Product"
FKColumn="orderId"
inversejoincolumn="productId"
lazy="true"
cascade="all"
orderby="productId">
• Product.cfc
<cfproperty
name="orders"
fieldtype="many-to-many"
CFC="Order"
linktable="Order_Product"
FKColumn="productId"
inversejoincolumn="orderId"
lazy="true"
cascade="all"
orderby="orderId">
The
here is the foreign key in the link table that references the primary key of the source table.
fkcolumn
is the foreign key in the link table that references the primary key of the target table. This
InverseJoinColumn
attribute can also take a composite key value, for example you can specify inversejoincolumn="field1, field2", where
field1 and field2 form the composite key.
Last updated 1/20/2012
565

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents