Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 633

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
package test.basic
{
[Bindable]
[RemoteClass(alias="AIRIntegration.employee")]
[Entity]
public class Employee
{
/** The user id of the employee **/
[Id]
public var id:int;
public var firstName : String;
public var lastName : String;
public var displayName : String;
....
public var countryCode : String = 'US';
....
}
Note: You do not need to create any SQLite databases or tables; they are created automatically. For example, once the
Employee class is defined as above, the first time you invoke the class, the equivalent SQLite table is created for server data
persistence.
Data object metadata
You use the following metadata to define the data object:
Metadata Element
[Entity]
[Table(name="tableName")]
[Id]
[Transient]
[Column(name="name",
columnDefinition="TEXT|INTEGER|
FLOAT|BOOLEAN|VARCHACHAR",
nullable=true|false, unique=true|false)]),
[RemoteClass]
Note: For private properties in a class, set [Column] metadata on the accessor functions (getxxx and setxxx) and not on
the private property, as shown in the following code:
Purpose
Specifies that instances of this class can be persisted to the SQLite database. This element is
required.
The name of the SQLite table in which the object is to be stored. Defaults to the name of the
class.
Precedes a field definition. Indicates that the field is a primary key in the table. For composite
keys, use Id tags on all the primary key fields.
A Boolean value specifying whether the property or field is persistent. A True value indicates
that the field is not persistent and so it is not a part of the client side Sqlite table.
Specifies the SQLite database column that contains data for this field.
name: Column name. If not specified, defaults to the property name.
columnDefinition: The SQL Datatype to use for the column.
nullable: Specifies whether a field can have a null value.
unique: Specifies whether the value for each field must be unique within the column.
Used for all remote objects, not just ColdFusion. The alias attribute identifies the
corresponding class on the remote server. This information is used to map between
ActionScript data types and the remote data types.
It is mandatory that you specify the [RemoteClass] metadata tag for the ActionScript classes
or entities that map with the server-side CFC. If you do not specify this metadata tag, you get
a runtime error. For example, you specify the alias name for the Address entity as follows:
[RemoteClass(alias="myFolder.AIRIntegration.Address")]
The alias name must be unique within the AIR application.
Last updated 1/20/2012
628

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents