Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 575

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
In this model, there are separate tables for each class in the hierarchy and these tables are joined by a primary key.
When the object is persisted, properties of the parent component are stored in the parent table and the remaining
properties are stored in the child table.
Payment
PaymentID <<PK>>
Amount
CreditCardPayment
paymentID
cardNo
cardType
Table per subclass without discriminator
In the preceding figure, the tables are joined by join column
Payment.cfc
<cfcomponent persistent="true" table="Payment">
<cfproperty name="paymentId">
<cfproperty name="amount">
</cfcomponent>
CreditCardpayment.cfc
<cfcomponent persistent="true" extends="Payment" table="CreditCardPayment"
joinColumn="paymentId">
<cfproperty name="cardNo">
<cfproperty name="cardType">
</cfcomponent>
CheckPayment.cfc
<cfcomponent persistent="true" extends="Payment" table="CheckPayment" joinColumn="paymentId">
<cfproperty name="checkNo">
<cfproperty name="bankName">
<cfproperty name="city">
</cfcomponent>
When an object of type
CreditCardPayment
properties
and
cardNo
cardType
CreditCardPayment remains the same as the primary key of the Payment table.
Table per subclass with discriminator
This model is similar to the table per subclass without discriminator strategy except that there is a discriminator
column in the parent table. In addition, the child components has a
tag.
cfcomponent
The following example demonstrates the table per subclass with discriminator attribute:
Payment.cfc
CheckPayment
paymentID
checkNo
bankName
city
paymentId
is persisted, the property
are stored in the CreditCardPayment table. The primary key of the
Last updated 1/20/2012
Payment class extended by
CheckPayment class
CreditCardPayment class
. You can model the tables as follows:
is stored in the payment table and the
amount
attribute in the
disciminatorValue
570

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents