Adobe COLDFUSION 9 Manual page 636

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
public class Employee
{
[Id]
[Column(name="ID")]
var id:uint;
[ManyToMany(targetEntity="Department",
fetchType="EAGER|LAZY(default)")]
[JoinTable(name="EMP_DEPT")]
[JoinColumn(name="EMPID", referencedColumnName="ID")]
[InverseJoinColumn(name="DEPID", referencedColumnName="DEPTID")]
var depts:ArrayCollection;
}
The default
value is
fetchType
For a many-to-many relationship, you specify metadata like the following only on one of the entities and not both.
[JoinTable(name="ORDER_PRODUCT")]
[JoinColumn(name="ORDER_ID",referencedColumnName="oid")]
[InverseJoinColumn(name="PRODUCT_ID",referencedColumnName="pid")]
The
tag specifies the foreign key column and all the attributes of the column tag. The
[JoinColumn]
tag specifies the reference to the joining entity in the
[InverseJoinColumn]
table "EMP_DEPT" has a column named "DEPID", which refers to the "DEPTID" column of the Department table.
The
tag defines the join table for the many-to-many relationship specifying the join column and inverse
[JoinTable]
join column. In this example, a join table named "EMP_DEPT" is created in the Offline SQLite DB with a many-to-
many relationship between the Employee and Department tables.
Lazy loading and fetch type
The ActionScript persistent framework supports lazy loading although it may not be as intuitive because of the
asynchronous connection with the database.
The fetch type
or
EAGER
LAZY
the relationship and fetches data when the call is first made. A LAZY fetch type loads the relationship and fetches data
only when an explicit fetch call is made. The default value for the fetch type is
is
.
ignoreLazyLoad
false
When you specify
fetchType="EAGER"
object, irrespective of the value you specify for the ignoreLazyLoad parameter.
When you specify
fetchType="LAZY"
• When you specify the
ignoreLazyLoad
have two related objects Address and Customer, and specify
object is also loaded.
• When you do not specify any value for the
the related object is not loaded. For example, if you have two related objects Address and Customer, and specify
loadByPK(Customer,{id:3})
Cascading options
Cascading lets you specify the operations to be cascaded from the parent object to the associated object. The supported
operations are INSERT, UPDATE, and DELETE. The
If The source entity is inserted, updated, or deleted, the target entity is also inserted, updated, or deleted.
ALL
. See
"Lazy loading and fetch
LAZY
determines the fetch type for the relationship that is loaded. An EAGER fetch type loads
at the class-definition level, the
at the class-definition level, you can have two possibilities:
parameter as
true
ignoreLazyLoad
, the Address object is not loaded.
cascadeType
Last updated 8/5/2010
type" on page 631 for information on fetch types.
[JoinTable]
and the default value for
EAGER
function always loads the related
loadByPk
, the related object is also loaded. For example, if you
loadByPK(Customer,{id:3},true)
parameter, it takes the default value that is
attribute lets you set any of the following values.
631
tag. In this example, join
, the Address
, and
false

Advertisement

Table of Contents
loading

Table of Contents