
650
DEVELOPING
COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Las
t
upda
te
d 8/5/2010
[ManyToMany(targetEntity="onetoone::Customer",fetchType="EAGER")]
[JoinTable(name="CUSTOMER_PARENTS_MAPPINGS")]
[JoinColumn(name="CUST_ID",referencedColumnName="cid")]
[InverseJoinColumn(name="PARENT_ID",referencedColumnName="cid")]
public var parents:Array;
// Many-to-Many self Join
[ManyToMany(targetEntity="onetoone::Customer",fetchType="EAGER")]
[JoinTable(name="CUSTOMER_CHILDREN_MAPPINGS")]
[JoinColumn(name="CUST_ID",referencedColumnName="cid")]
[InverseJoinColumn(name="CHILD_ID",referencedColumnName="cid")]
public var children:Array;
[OneToMany(targetEntity="onetoone::Order",cascadeType='REMOVE',mappedBy="customer",fetchType
="EAGER")]
public var orders:Array;
}
}
ArrayCollection to hold multiple entities
In addition to Array, you can now use ArrayCollection to hold multiple entities in a database relationship.
ArrayCollection can also be used in the ActionScript entities as Arrays are used to represent the related entities.
Example
package
{
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="AIRIntegration.customer")]
[Entity]
public class Customer
{
[Id]
[GeneratedValue(strategy="INCREMENT",initialValue=5,incrementBy=2)]
public var cid:int;
public var name:String;
[OneToOne(cascadeType='ALL',fetchType="EAGER")]
[JoinColumn(name="add_id",referencedColumnName="aid")]
public var address:Address;
[OneToMany(targetEntity="onetoone::Order",cascadeType='REMOVE',mappedBy="customer",fetchType
="EAGER")]
public var orders:ArrayCollection;
}
}
Server-side configuration
See the section “
Changes in the XML configuration files for Flash Remoting in ColdFusion 9 and ColdFusion 9.0.1
”
on page 674.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...