cfdocs

cfproperty

Defines properties of a CFML component (CFC). Used to create complex data types for web services. The attributes of this tag are exposed as component metadata and are subject to inheritance rules.

Syntax

<cfproperty name="">

Attribute Reference

Name Type Required Default Description    
name string Yes   Specifies the name of the property.    
type string No   Specifies the ColdFusion data type for the property.    
required boolean No   Whether the parameter is required    
default string No   This sets the default value on the property when the object is created. For ORM Entities, this only works for static values. Variable values like the current timestamp can be set by a function “preInsert” in the component.    
displayname string No   A value to be displayed when using introspection to show
information about the CFC. The value appears in parentheses
following the property name.
   
hint string No   Text to be displayed when using introspection to show
information about the CFC. This attribute can be useful
for describing the purpose of the parameter.
   
fieldtype string No   This attribute is used to specify the type of the property. Use this attribute to specify the following:
* Primary key: Specify fieldtype = “id” to map a property to the primary key in the table.
* Column: Specify the fieldtype = “column” to map a property to a column in the table.
* Relationship: Specify the fieldtype = “relationship_type”. The relationship_type can be one-to-one, one-to-many, many-to-one, or many-to-many.
* Version: Specify the fieldtype=”version‚Äù to indicate that the column contains versioned data.
* Timestamp: Specify the fieldtype=”timestamp” to indicate the column contains data with timestamp.
* Collection: Specify the fieldtype=”collection” to define the collection mapping.
   
ormType string No   Used to specify the data type of the primary key. If data type is not set and the ORM setting
useDBForMapping=true, then the ormtype is determined by inspecting the database.
   
column string No   Used to specify the primary key column name.    
generator string No   Algorithm used to generate unique identifiers for instances of the persistent CFC.    
sequence string No   Sequence key name in the database.    
selectkey string No   The column name that is used to retrieve the primary key generated by a database trigger.    
params string No   Additional parameters required by the various generators to generate the ID.
The value for the params attribute should follow the CF Struct syntax. For example: params = {key1=’value1’, key2=’value2’}
   
length string No   Use this attribute to specify the length of the column. This attribute is used for table creation only.    
precision string No   Specifies the precision value.    
index string No   Specifies the name of an index that is created using the mapped column    
setter boolean No   Specifies whether to generate setter methods or not    
getter boolean No   Specifies whether to generate getter methods or not    
source string No vm Specifies the source from where the timestamp has to be retrieved    
elementcolumn string No   Column name in the table that is used as value in struct.    
elementtype string No   Data type of the value.    
structkeytype string No   Specifies the data type of the key, when collectiontype=struct.    
structkeycolumn string No   The column in the target table to use as key if the collection type is struct.    
inversejoincolumn string No   Specifies the foreign key column in the Join table that references the primary key column in the target table.    
linkschema string No   Schema for the link table    
linkcatalog string No   Catalog for the link table    
linktable string No   Name of the link table    
missingRowIgnored boolean No   If the value is true, and the row that is referenced by the foreign key is missing, it is treated as a null
association. The default is false, in which case an exception occurs.
   
inverse boolean No   A Boolean value that specifies bidirectional association    
orderby string No   Specifies the Order By string.    
fkcolumn string No   Specifies the foreign key column    
fetch string No   Specifies if it is outer-join fetching or sequential select fetching    
cascade string No   Specifies which operations should be cascaded from the parent object to the associated object    
constrained boolean No   Whether a constraint is set on this table’s Primary Key column to reference the Primary Key in the other table    
unique boolean No   Specifies if there should be a unique constraint on the column.    
uniquekey string No   Groups columns in a single unique key constraint.    
notnull boolean No   A Boolean value that specifies whether a notnull constraint should be added for this column.    
update string No   Whether the column should be included in the SQL update statement.
Set update=false and insert=false if the column needs to be read-only.
   
insert boolean No   Whether the column should be included in SQL UPDATE and/or INSERT statements.
Set update=false and insert=false if the column needs to be read-only.
   
generated string No   Specifies that this property value is actually generated by the database {never always insert}
* never: Specifies that the value for this property is never generated by database
* always: Specifies that the value for this property is always generated by database
* insert: Specifies that the value for this property is generated at the time of insert but is not regenerated at updates.
formula string No   SQL expression that defines the value of the property. If you specify a formula, the column value is ignored.    
lazy string No   Specifies if loading is to be done by parts:    
optimisticLock boolean No   Whether updates to this property require acquisition of the optimistic lock on the table row    
scale string No   Specifies the scale value    
mappedby string No   Property in the target CFC that is referenced by the foreign key in the Join table.    
cfc string No   Name of referenced CFC    
joinColumn string No   Use this attribute to define the join column for inheritance mapping.    
validate string No   Takes the validator to be used for validating data when implicit setter for this property is called.    
validateParams string No   Takes the parameters required by the validator specified in the validate attribute.
This should be specified in the implicit struct notation eg. validateparams=”{min=18,max=60}”>.

min: Minimum value if validate is integer/numeric/
max: Maximum value if the validate is integer/numeric/
minLength: Minimum length of the string if the validate is string
maxLength: Maximum length of the string if the validate is string
pattern: regex expression if the validator specified in validate attribute is regex
   
cacheUse string No   Type of cache to use    
sqlType string No   Use this attribute to specify the DB-specific SQLType that should be used for the column. This attribute is used for table creation only.
If this attribute is not specified, ColdFusion will automatically decide the SQLType based on the ormtype specified for this property.
   
dbDefault string No   This sets the default value of a column in the table when schema is exported.    
where string No   Where condition    
persistent boolean No   Specifies whether this property should be persisted. If
persistent=”false‚ all the ORM related attributes are ignored.
Set this attribute to false if you do not want this property to be persisted by ORM.
   
unSavedValue string No   An identifier property value that indicates that an instance is newly instantiated and not saved/loaded in the database    
serializable boolean No   Specifies whether this property can be serialized. If you set this value to
false, the property cannot be serialized, so any changes made are not retained on session replication, and the property has its default value (if any) on the second server.
Use this attribute to prevent serialization of properties in CFCs that are serializable.
   
singularname string No   Use this property to define the custom name for generated relationship methods. Applies to one-to-many and many-to-many    
remotingFetch boolean No   If remotingFetch is false, then the value of that attribute is not sent over flash remoting. remotingFetch is true by default was all properties. But in case of cfcs for which persistent = true, the value of the remotingFetch attribute is false by default for any property that shares one-to-one, one-to-many, many-to-one or many-to-many relationship.    
table string No   Table name