Relating Tables with Manager.cfc

Today we continue our quest to use com.sebtools to easily manage records and files in our example HR application. So far, we have defined our data set with XML, gotten that definition into Records.cfc, and consolated our multi-table application with ProgramManager.cfc. The last step wasn't necessary for a multi-table application, but does make things nice.

What we don't have, however, is any interaction among our tables. We have Departments and Employees, but no relationship between the two. For this example, an employee can work for one (and only one) department.

There are a few pieces of information that are helpful for most of these sorts of relationships. We would like to know the name of the department for every employee (and perhaps a boolean indicating if that employee is in a department). We would also like to have the number of employees for any given department and a boolean indicating whether or not that department has any employees. Fortunately, Manager.cfc can provide all of this for one short line of code.

[More]

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Is an fentity field automatically a required field? If so, is it safe to assume we can override?
# Posted By Tim DeMoss | 2/9/11 7:31 PM
Tim,

Not required. You can, of course make it required just by adding required="true" to the field.
# Posted By Steve Bryant | 2/9/11 8:36 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.