Adobe COLDFUSION 9 Manual page 605

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

600
DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
/**
* Strategy to specify the table name for a CFC and column name for a property in the cfc.
* This can be used to specify the application specific table and column naming convention.
* This rule will be applied even if the user has specified the table/column name in the mapping
so that
* the name can be changed for any application at one place without changing the names in all the
code.
*/
interface
{
/**
* Defines the table name to be used for a specified table name. The specified table name is either
* the table name specified in the mapping or chosen using the entity name.
*/
public string function getTableName(string tableName);
/**
* Defines the column name to be used for a specified column name. The specified column name is
either
* the column name specified in the mapping or chosen using the proeprty name.
*/
public string function getColumnName(string columnName);
}
This interface is specified in the application using:
this.ormsettings.namingstrategy="com.adobe.UCaseStrategy"
Note: The naming strategy applies to all the table or column names, which you use in the mapping including link table
and fkcolumn, even though there is no CFC or cfproperty associated with them.
Populating the database using script
After the tables are created using DDL, you can optionally populate the database with data using SQL script. To do
this, specify the path (absolute file path or path relative to the application) to the SQL script file that has to be executed.
The script is run only when
is set to
. The SQL script file lets you populate the tables before the
dbcreate
dropcreate
application is accessed. Ensure that each SQL statement starts on a new line and ends with a semi-colon.
Example
Mysqlscript.sql
insert into Artists(artistid, firstname, lastname, address, city, state, postalcode, email,
phone, fax, thepassword)
values(1, 'Aiden', 'Donolan', '352 Corporate Ave.', 'Denver', 'CO', '80206-4526',
'aiden.donolan@donolan.com', '555-751-8464', '555-751-8463', 'peapod');
insert into Artists(artistid, firstname, lastname, address, city, state, postalcode, email,
phone, fax, thepassword)
values(2, 'Austin', 'Weber', '25463 Main Street, Suite C', 'Berkeley', 'CA', '94707-4513',
'austin@life.com', '555-513-4318', '510-513-4888', 'nopolyes');
insert into Art(artname, price, largeimage, mediaid, issold, artistid)
values('Michael', 13900, 'aiden02.jpg', 1, 0, 1);
insert into Art(artname, price, largeimage, mediaid, issold, artistid)
values('Space', 9800, 'elecia01.jpg', 2, 1, 2);
Last updated 8/5/2010

Advertisement

Table of Contents
loading

Table of Contents