
647
DEVELOPING
COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Las
t
upda
te
d 8/5/2010
Parameters
If the ID value is not present in the object, the value is generated and is assigned the primary key value. If the key value
is already present on the object instance, then the key generation is ignored.
For integer primary keys, the database table is checked for the presence of existing primary keys. If the highest key
value is greater than the
initialValue
, then the key that is generated next will be an increment of the highest key
value. For example, if the
initialValue
that you specify is
1
, and the database (already) has a key value
5
, then the
next key is generated with the value
6
(5+1, if
incrementBy
is set to
1
).
Example
//Integer Primary Keys
===========
package test.apollo.CFSQLiteSupport.INCREMENTPK
{
[Entity]
[RemoteClass(alias="Customer")]
public class Customer
{
public function Customer()
{
}
[Id]
[GeneratedValue(strategy="INCREMENT",initialValue=5,incrementBy=2) ]
public var cid:int;
public var name:String;
[OneToOne(mappedBy="customer")]
public var ord:Order;
}
}
Parameter
Description
strategy
UUID uses the Flash UUID API to generate the ID (used for primary key of type
string
) or INCREMENT (for primary key
of type
int
).
initialValue
Applies only for INCREMENT strategy. Specifies the initial value of the primary key. The default value is 0.
incrementBy
Applies only for INCREMENT strategy. Specifies the integer with which the value must be incremented to generate the
primary key.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...