We recently* discussed how use a DAO to map a single record from a single database table to a Bean Object under a one to many relationship. Now we need to discuss how to use a DAO to populate a Bean with data from multiple tables under a many to many relationship.
A reader of my OOCF Primer asks: "Instead of having multiple cfc's can one have just 1 cfc?" The answer is: it depends.
We've seen how to convert data list and data detail pages from procedural code to Mach-II events. Now we need to refactor how we build form and action pages.
We last discussed how to manage recordsets with Mach-II. Now it's (finally) time to discuss how to work with individual records using Beans and Data Access Objects (DAOs).
Ok, so we've got the concept of a DAO and how it interacts with a bean. Here's an example of a form and an action page using Object Oriented Coldfusion.