Example

Application.cfc

<cfset this.name = "AG"/>
<cfset this.ormenabled=true/>
<cfset this.datasource = "ORM_DDL">
<cfset this.ormsettings.dbCreate="dropcreate">
<cfset this.ormsettings.sqlscript="mysqlscript.sql">

Artists.cfc

<cfcomponent persistent="true" table="Artists">
<cfproperty name="artistid" fieldtype="id" ormtype="integer" length=10>
<cfproperty name="firstname" ormtype="string" length="20" notnull="true">
<cfproperty name="lastname" ormtype="string" length="20" notnull="true">
<cfproperty name="address" ormtype="string" length="50">
<cfproperty name="city" ormtype="string" length="20">
<cfproperty name="state" ormtype="string" length="2">
<cfproperty name="postalcode" ormtype="string" length="10">
<cfproperty name="email" ormtype="string" length="50" unique="true">
<cfproperty name="phone" ormtype="string" length="20">
<cfproperty name="fax" ormtype="string" length="12">
<cfproperty name="thepassword" ormtype="string" length="20">
</cfcomponent>

art.cfc

<cfcomponent persistent="true" table="Art">
<cfproperty name="artid" generator="identity" fieldtype="id">
<cfproperty name="artname" ormtype="string" length="50">
<cfproperty name="price" ormtype="double">
<cfproperty name="largeimage" ormtype="string" length="30">
<cfproperty name="mediaid" ormtype="integer" length="10">
<cfproperty name="issold" ormtype="boolean" dbdefault=1>
<cfproperty name="artist" fkcolumn="artistid" fieldtype="many-to-one" cfc="CArtists">
</cfcomponent>

Get help faster and easier

New user?