Viewers: in countries Watching now:
ColdFusion 9 Essential Training is a detailed overview of ColdFusion, demonstrating each of the components and tools necessary to create dynamic web sites and web applications. Author and web developer David Gassner starts this course at the very beginning: how to set up a ColdFusion application server in both the Windows and Mac OS X operating systems. Using the new ColdFusion Builder, David explains the data types and code necessary to build and deploy dynamic web pages. Throughout the course, he shows how to build web pages and forms and populate these containers with dynamic data using ColdFusion ORM (Object Relational Mapping), a new feature of ColdFusion 9. Exercise files accompany this course.
Once you've created a data entry form that allows the user to submit values for a database record, you can then insert the data using a very simple bit of code that depends on the Object Relational Mapping features that are new to ColdFusion 9. I am going to start in this demonstration by examining the structure of my photographer table into which I am going to insert data. It has four columns: the FIRSTNAME and LASTNAME column, which are both variable character columns, the FEATURED column, an integer, which I am going to put either a value of zero or one into, and the PHOTOGRAPHERID, a primary key.
In Apache Derby and in a number of other databases such as MySQL and SQL Server, you can set up database table structures that auto-increment their values. That is to say, when you add a new record into a database table, the database assigns the next available value to the primary key, so you don't have to worry about it. You can leverage this functionality using Object Relational Mapping but you have to add a little bit of code to the definition of the structure in your orm file.
I'll go to my photogallery project, to the cfc/orm folder and I'll open the cfc that represents the structure of the Photographer table and I'll double-click the tab to see all of the code. Here is what the code looks like so far. For the primary key column, the name is PHOTOGRAPHERID and the column in the database table is the same, PHOTOGRAPHERID. The ormtype is set to int for integer and the fieldtype is set to id.
If I leave this code as it is, I would have to explicitly assign the PHOTOGRAPHERID value before I insert data, and that's not what I want. Instead I want the underlying Hibernate engine to allow the database to assign the value. To define that, I'll add a new attribute to the cfproperty tag called generator. You'll see that there are a number of values available and if you're curious you can look at the documentation for this attribute to see what's possible. But for these databases that dynamically generate their own identity values I am going to set the value of generator to identity, and then I'll save the change.
In order for ColdFusion to see this change and respect it, I must restart the ColdFusion application. One is to restart the whole server. That takes quite a while. In fact it takes one or two minutes for the entire server to shut down and then restart again. So, I am going to create a file that incorporates a new ColdFusion tag called Application stop. This will be a page that I only call myself, so it's not going to be linked into any of the other parts of the application. I'll go to the photogallery project, I'll right-click on it and select New ColdFusion Page and I'll name the page and appstop and click Finish or press Enter.
Within the body tag I'll create a cfset command and I'll call this new applicationStop method. This will cause the current application to stop on the server and then the next time any page of the application is loaded into a browser that will restart the application and ColdFusion will rescan my cfc folders for my ORM or Object Relational Mapping files and it will reread the mappings and recreate them in memory. I'll finish this page by just outputting an h1 tagset and a bit of literal text 'Application stopped.' I'll run the page in the browser and now the next time I want to use my component, my new rules will take effect.
Find answers to the most frequently asked questions about ColdFusion 9 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.