Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 576

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
<cfcomponent persistent="true" table="Payment" discriminatorColumn="paymentType">
<cfproperty name="paymentId">
<cfproperty name="amount">
</cfcomponent>
CreditCardPayment.cfc
<cfcomponent persistent="true" extends="Payment" table="CreditCardPayment"
joinColumn="paymentId" discriminatorValue="CCard">
<cfproperty name="cardNo">
<cfproperty name="cardType">
</cfcomponent>
CheckPayment.cfc
<cfcomponent persistent="true" extends="Payment" table="CheckPayment" joinColumn="paymentId"
discriminatorValue="Check">
<cfproperty name="checkNo">
<cfproperty name="bankName">
<cfproperty name="city">
</cfcomponent>
When an object of type CreditCardPayment is persisted, the property
properties
and
cardNo
cardType
remains the same as the primary key of the Payment table. The value of PaymentType is the value of
attribute of the respective object.
disciminatorColumn
Embedded mapping
This mapping is used when a CFC has an embedded object which also needs to be persisted along with the parent's
data. The CFC of the embedded object must have the attribute
Important: The embedded object cannot be a persistent object. This feature is supported only when the hibernate
mapping is explicitly defined in the hibernate mapping file (.hbmxml files).
Name
EmployeeID
FirstName
EmployeeName
LastName
Designation
Title
Name.cfc embedded in Employee.cfc
The diagram shows two CFCs Employee and Name where EmployeeName field of the Employee.cfc is an object of
Name.cfc. In the database, both these objects are persisted in the Employee table as a single row. Name object itself
does not have its own identity. This mapping can be modeled as follows:
name.cfc
<cfcomponent embedded="true">
<cfproperty name="FirstName">
<cfproperty name="LastName">
<cfproperty name=" Title">
</cfcomponent>
employee.cfc
are stored in the CreditCardPayment table. The primary key of CreditCardPayment
Employee
Last updated 1/20/2012
is stored in the payment table and the
amount
set to "
" on the cfcomponent tag.
embedded
true
571

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents