
563
DEVELOPING
COLDFUSION 9 APPLICATIONS
ColdFusion ORM
Las
t
upda
te
d 8/5/2010
<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="struct"
orderby="order_by_String"
structkeycolumn = "Structure_Key_Column"
structkeytype="ormtype"
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, you can define the relationship property as:
<cfproperty name="art" type="struct" fieldtype="one-to-many" cfc="Art" fkcolumn="ARTISTID"
structkeytype="int" structkeycolumn="ArtID">
•
type=struct
specifies that the artist object will contain art objects in a struct.
•
structkeycolumn="ArtID"
specifies that the key of the struct would be ArtID.
Note that ARTID is the primary key in Art table.
•
structkeytype="int"
specifies the datatype of
structkeycolumn
.
•
fkcolumn="ArtistID"
specifies that the foreign key column is ARTISTID that references the primary key of Artist
table.
Many-to-one relationship
A many-to-one relationship is the inverse of a one-to-many relationship. In this relationship, many source objects can
reference the same target object.
An example of this relationship is the relation between Art and Artist, where many Art are created by the same Artist.
This relationship is established with the foreign key in the source table that references the primary key in the target
table.
A many-to-one relationship between two persistent components is defined using the
fieldtype
value
many-to-one
in the
cfproperty
tag.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...