Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 574

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
• Table per subclass without discriminator
• Table per subclass with discriminator
Table per hierarchy
In this model, the object hierarchy is persisted in a single table. This table includes columns for all the properties of all
the CFCs in the hierarchy. The concrete subclass represented by a row is identified based on the value of the
column. In this strategy, all the CFCs of the hierarchy must have the same table name.
discriminator
Note: If the discriminator column and discriminator value is not specified, a default discriminator column name and
value is picked up.
Example
The following example demonstrates an implementation of table per hierarchy:
Payment
PaymentID <<PK>>
PaymentType <<Discriminator>>
Amount
CardNo
CardType
CheckNo
BankName
City
Example for table per hierarchy
In the preceding figure,
discriminatorColumn
it is credit card or check, the row is represented as a
The following example illustrates how you can model the table per hierarchy:
Payment.cfc (parent class)
<cfcomponent persistent="true" table="Payment" discriminatorColumn="paymentType">
<cfproperty name="id">
<cfproperty name="amount">
</cfcomponent>
CreditCardPayment.cfc
<cfcomponent persistent="true" extends="Payment" table="Payment" discriminatorValue="CCard">
<cfproperty name="cardNo">
<cfproperty name="cardType">
</cfcomponent>
CheckPayment.cfc
<cfcomponent persistent="true" extends="Payment" table="Payment" discriminatorValue="check">
<cfproperty name="checkNo">
<cfproperty name="bankName">
<cfproperty name="city">
</cfcomponent>
Payment Table
Payment (extended by)
Check Payment
CreditCard Payment
is
. Depending on the values of
PaymentType
CreditCardpayment
Last updated 1/20/2012
PaymentType
or
object respectively.
checkPayment
569
whether

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents