
565
DEVELOPING
COLDFUSION 9 APPLICATIONS
ColdFusion ORM
Las
t
upda
te
d 8/5/2010
<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
fkcolumn
here is the foreign key in the link table that references the primary key of the source table.
InverseJoinColumn
is the foreign key in the link table that references the primary key of the target table. This
attribute can also take a composite key value, for example you can specify inversejoincolumn=”field1, field2”, where
field1 and field2 form the composite key.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...