|
The Adobe CFC Generator generator generates ORM CFCs (ColdFusion
Components) from database tables. The Adobe CFC Generator extension
lets you create a traditional CFC or an ORM CFC from a set of tables.
Object Relational Mapping (ORM) is a programming technique that
lets you define a mapping strategy to store and retrieve data from
a relational database using object models. The Adobe CFC Generator
lets you define the mapping for relations, specify join conditions,
and generate services for the CFCs. For more information about ORM,
see ColdFusion
ORM in the ColdFusion Developer Guide.
Install Adobe CFC GeneratorThe Adobe CFC Generator extension is installed with ColdFusion
Builder, if you selected the Install Extension option when creating
a server.
If you did not install the extension when creating a server and
want to install it now, see Install and uninstall extensions. The Adobe CFC Generator extension archive
file (AdobeCfcGenerator.zip) comes packaged with ColdFusion Builder. The
archive file is in the Extensions directory within the ColdFusion
Builder installation.
Use Adobe CFC GeneratorIn the ColdFusion Builder perspective, select
RDS Dataview.
If you have configured an RDS user name and password, specify
the RDS user name and password.
Note: You set the RDS password
in the ColdFusion Administrator. Do not confuse the RDS password
with the ColdFusion Administrator password, which is also managed
through the ColdFusion Administrator.
The list of data sources available in the configured server
are listed.
Select a data source and the table for which you want to
generate CFCs. You can select multiple tables at once by pressing
Shift and selecting the table names.
Right-click the selected tables, select Adobe CFC Generator,
and select one of the following options: Note: The Adobe CFC Generator
option appears only if you right-click a table name. Clicking the
data source or records within the data source does not show these
options.
- Create CFC
- Generates a ColdFusion component.
- Create ORM CFC
- Generates an ORM CFC and maps it to the database.
Create CFCRight-click a table in the selected data source,
for example, APP.EMPLOYEES table, and select Adobe CFC Generator
> Create CFC.
In the Adobe CFC Generator dialog box, do the following:
You can modify the CFC source code to provide additional functionality.
Create ORM CFCRight-click a table in the selected data source,
for example, APP.EMPLOYEES table, and select Adobe CFC Generator
> Create ORM CFC.
Specify the location to store the generated CFCs.
The Adobe CFC Generator dialog box displays the selected
database tables and fields in a dynamic, editable, sortable, data
grid. Note: Because the data grid is an Ajax-rich user interface,
it can sometimes take a few moments to load.
You can
customize the ORM CFC as follows:
Change the CFC Name:
You can edit the auto-generated CFC name in the CFC Name field.
Change the property name: You can edit the property name
in the Property Name field.
Change the property type: To edit a property type, click
the property type that appears in the Property Type column and select
a property type from the drop-down list.
Specify the primary key: You can edit the primary key settings
by selecting "True" or "False" for the required column.
You can include or exclude columns that you want to generate
in the CFC by selecting or deselecting the check box next to each
column name.
Sorting data: You can sort tables and columns that appear
in the data grid. The direction of the sort can be either ascending
or descending. To sort table names, click the Tables column and
select the sort order. To sort column data, click the column heading
and select the sort order.
To generate a basic ORM CFC, click the Generate Code link.
To
define relations and join conditions for the ORM CFC, do the following:
In the Relationships data grid, click Insert. A new row is
inserted.
Click the Relation Name field and enter a name for the relationship.
For example, you can define a relationship between the Art table
and Artists table.
Select the target table from the Target Table drop-down list.
Specify the relationship type by selecting the Multiplicity
drop-down list.
Specify a Link table, if necessary.
Click Save.
When you define a relationship, define a join condition.
To define a join condition for the specified relationship, click
the target table that you selected in step 3.
Click Insert in the Join Conditions data grid.
Select the source field from the Source drop-down list.
Select the target field from the Target drop-down list.
Click Save.
Click the Generate Code link.
In the Navigator view, right-click the folder that contains
the CFC and select Refresh. You can modify the CFC source code to
provide additional functionality.
|
|
|