Data object metadata

You use the following metadata to define the data object:

Metadata Element

Purpose

[Entity]

Specifies that instances of this class can be persisted to the SQLite database. This element is required.

[Table(name="tableName")]

The name of the SQLite table in which the object is to be stored. Defaults to the name of the class.

[Id]

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.

[Transient]

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.

[Column(name="name", columnDefinition="TEXT|INTEGER| FLOAT|BOOLEAN|VARCHACHAR", nullable=true|false, unique=true|false)]),

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.

[RemoteClass]

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.

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:
private var name:String; // Private property 
[Column(name="FNAME",columnDefinition="VARCHAR")] 
public function set fname(name:String):void // accessor function 
{ 
        this.name = name; 
} 
public function get fname():String // accessor function 
{ 
        return name; 
}