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.

 <cfproperty name="">

cfproperty Attribute Reference

name
Required

Specifies the name of the property.

type

Specifies the ColdFusion data type for the property. Values:
  • any
  • array
  • binary
  • boolean
  • date
  • guid
  • numeric
  • query
  • string
  • struct
  • uuid
  • variablename

required

Whether the parameter is required

default

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

A value to be displayed when using introspection to show
information about the CFC. The value appears in parentheses
following the property name.

hint

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

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. Values:
  • id
  • column
  • one-to-one
  • one-to-many
  • many-to-many
  • many-to-one
  • collection
  • timestamp
  • version

ormType

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. Values:
  • string
  • character
  • char
  • short
  • integer
  • int
  • long
  • big_decimal
  • float
  • double
  • boolean
  • yes_no
  • true_false
  • text
  • date
  • timestamp
  • binary
  • serializable
  • blob
  • clob

column

Used to specify the primary key column name.

generator

Algorithm used to generate unique identifiers for instances of the persistent CFC. Values:
  • increment
  • identity
  • sequence
  • seqhilo
  • uuid
  • guid
  • native
  • assigned
  • select
  • foreign
  • sequence-indentity

sequence

Sequence key name in the database.

selectkey

The column name that is used to retrieve the primary key generated by a database trigger.

params

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

Use this attribute to specify the length of the column. This attribute is used for table creation only.

precision

Specifies the precision value.

index

Specifies the name of an index that is created using the mapped column

setter

Specifies whether to generate setter methods or not

getter

Specifies whether to generate getter methods or not

source
Default: vm

Specifies the source from where the timestamp has to be retrieved Values:
  • vm
  • db

elementcolumn

Column name in the table that is used as value in struct.

elementtype

Data type of the value. Values:
  • string
  • character
  • char
  • short
  • integer
  • int
  • long
  • big_decimal
  • float
  • double
  • boolean
  • yes_no
  • true_false
  • text
  • date
  • timestamp
  • binary
  • serializable
  • blob
  • clob

structkeytype

Specifies the data type of the key, when collectiontype=struct. Values:
  • string
  • character
  • char
  • short
  • integer
  • int
  • long
  • big_decimal
  • float
  • double
  • boolean
  • yes_no
  • true_false
  • text
  • date
  • timestamp
  • binary
  • serializable
  • blob
  • clob

structkeycolumn

The column in the target table to use as key if the collection type is struct.

inversejoincolumn

Specifies the foreign key column in the Join table that references the primary key column in the target table.

linkschema

Schema for the link table

linkcatalog

Catalog for the link table

linktable

Name of the link table

missingRowIgnored

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

A Boolean value that specifies bidirectional association

orderby

Specifies the Order By string.

fkcolumn

Specifies the foreign key column

fetch

Specifies if it is outer-join fetching or sequential select fetching Values:
  • join
  • select

cascade

Specifies which operations should be cascaded from the parent object to the associated object Values:
  • all
  • none
  • save-update
  • delete
  • all-delete-orphan
  • delete-orphan
  • create
  • merge
  • lock
  • refresh
  • evict
  • replicate

constrained

Whether a constraint is set on this table's Primary Key column to reference the Primary Key in the other table

unique

Specifies if there should be a unique constraint on the column.

uniquekey

Groups columns in a single unique key constraint.

notnull

A Boolean value that specifies whether a notnull constriant should be added for this column.

update

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

Whether the column should be included in SQL UPDATE and/or INSERT tatements.
Set update=false and insert=false if the column needs to be read-only.

generated

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. Values:
  • never
  • insert
  • always

formula

SQL expression that defines the value of the property.If you specify a formula, the column value is ignored.

lazy

Specifies if loading is to be done by parts: Values:
  • YES
  • NO
  • extra

optimisticLock

Whether updates to this property require acquisition of the optimistic lock on the table row

scale

Specifies the scale value

mappedby

Property in the target CFC that is referenced by the foreign key in the Join table.

cfc

Name of referenced CFC

joinColumn

Use this attribute to define the join column for inheritance mapping.

validate

Takes the validator to be used for validating data when implicit setter for this property is called. Values:
  • string
  • boolean
  • integer
  • numeric
  • date
  • time
  • creditcard
  • email
  • eurodate
  • ssn
  • telephone
  • UUID
  • guid
  • zipcode

validateParams

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
minLength: Maximum length of the string if the validate is string
pattern: regex expression if the validator specified in validate attribute is regex

cacheUse

Type of cache to use Values:
  • read-only
  • nonstrict-read-write
  • read-write
  • transactional

sqlType

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

This sets the default value of a column in the table when schema is exported.

where

Where condition

persistent

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

An identifier property value that indicates that an instance is newly instantiated and not saved/loaded in the database

serializable

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 serializaton of properties in CFCs that are serializable.

singularname

Use this prperty to define the custom name for generated relationship methods. Applies to one-to-many and many-to-many

remotingFetch

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. Values:
  • NO
  • YES

table

Table name

Fork me on GitHub