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="">

Attribute Reference for the cfproperty tag

name

Required: Yes
Specifies the name of the property.

type

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

required

Required: No
Whether the parameter is required

default

Required: 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

Required: 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

Required: 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

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

ormType

Required: 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. 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

Required: No
Used to specify the primary key column name.

generator

Required: No
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

Required: No
Sequence key name in the database.

selectkey

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

params

Required: 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

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

precision

Required: No
Specifies the precision value.

index

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

setter

Required: No
Specifies whether to generate setter methods or not

getter

Required: No
Specifies whether to generate getter methods or not

source

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

elementcolumn

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

elementtype

Required: No
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

Required: No
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

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

inversejoincolumn

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

linkschema

Required: No
Schema for the link table

linkcatalog

Required: No
Catalog for the link table

linktable

Required: No
Name of the link table

missingRowIgnored

Required: 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

Required: No
A Boolean value that specifies bidirectional association

orderby

Required: No
Specifies the Order By string.

fkcolumn

Required: No
Specifies the foreign key column

fetch

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

cascade

Required: No
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

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

unique

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

uniquekey

Required: No
Groups columns in a single unique key constraint.

notnull

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

update

Required: 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

Required: No
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

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

formula

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

lazy

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

optimisticLock

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

scale

Required: No
Specifies the scale value

mappedby

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

cfc

Required: No
Name of referenced CFC

joinColumn

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

validate

Required: No
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

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

cacheUse

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

sqlType

Required: 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

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

where

Required: No
Where condition

persistent

Required: 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

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

serializable

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

singularname

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

remotingFetch

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

table

Required: No
Table name


Fork me on GitHub