<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>ColdFusioning - ORM</title>
			<link>http://www.coldfusioning.com/index.cfm</link>
			<description>My personal blog about ColdFusion, code, Adobe, Google, &amp; computers...</description>
			<language>en-us</language>
			<pubDate>Tue, 07 Sep 2010 13:44:57 -0400</pubDate>
			<lastBuildDate>Wed, 04 Aug 2010 03:53:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>james@gulftobaytrading.com</managingEditor>
			<webMaster>james@gulftobaytrading.com</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>james@gulftobaytrading.com</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			<itunes:image href="" />
			<image>
				<url></url>
				<title>ColdFusioning</title>
				<link>http://www.coldfusioning.com/index.cfm</link>
			</image>
			<itunes:explicit>no</itunes:explicit>
			
			<item>
				<title>ColdFusion / Railo Object Relational Mapping - ORM Source Code and Notes</title>
				<link>http://www.coldfusioning.com/index.cfm/2010/8/4/ColdFusion--Railo-Object-Relational-Mapping--ORM-Source-Code-and-Notes</link>
				<description>
				
				&lt;style&gt;
#list li{
margin-left: 25px;
}
#list li ul li{
margin-left: 50px !important;
}
&lt;/style&gt;
Tonight I gave a presentation on using ORM with ColdFusion or Railo.  You can watch the recorded presentation on &lt;a href=&quot;http://experts.na3.acrobat.com/p69672624/&quot; onClick=&quot;recordOutboundLink(this, &apos;Outbound Links&apos;, &apos;experts.na3.acrobat.com/p69672624/&apos;);return false;&quot;&gt;Adobe Connect&lt;/a&gt;.  As promised, I&apos;m publishing the source code from the meeting.  
&lt;br /&gt;&lt;br /&gt;
Since the code uses ColdBox and a database,  it requires some setup.  If you follow the steps below, you&apos;ll be able to get setup to run the examples:
&lt;br /&gt;&lt;br /&gt;
&lt;ul id=&quot;list&quot;&gt;
	&lt;li&gt;Setup ColdBox with a mapping (&quot;/coldbox&quot;) to the ColdBox source &lt;br /&gt;(I&apos;m using Version 3115)&lt;/li&gt;
	&lt;li&gt;Unzip the &lt;a href=&quot;/files/ColdFusion-Railo-ORM-1.0.rar&quot; onClick=&quot;recordOutboundLink(this, &apos;Downloads&apos;, &apos;ColdFusion-Railo-ORM&apos;);return false;&quot;&gt;source files&lt;/a&gt; to a empty directory&lt;/li&gt;
	&lt;li&gt;Setup a new site (I&apos;m using &quot;http://office.scribble/&quot; in the examples)&lt;/li&gt;
	&lt;li&gt;In ColdFusion Admin
&lt;ul&gt;
		&lt;li&gt;Setup a mapping &quot;scribble&quot; that points at the directory&lt;/li&gt;
		&lt;li&gt;Create a datasource pointing at a new database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
	&lt;li&gt;Update Application.cfc with the new datasource (line 24)&lt;/li&gt;
	&lt;li&gt;Call the application from the browser&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
At this point, you should see the ColdBox version number and a list of actions.  You&apos;ll want to run the &quot;Reload&quot; link first so the tables are all created.  I&apos;m not sure why, but if you receive an error on the &quot;Reload&quot; page, refresh the browser a couple times and I&apos;ll complete properly.
&lt;br /&gt;&lt;br /&gt;
If you have problems setting up ColdBox, please refer to the ColdBox Documentation at &lt;a href=&quot;http://wiki.coldbox.org/&quot;  onClick=&quot;recordOutboundLink(this, &apos;Outbound Links&apos;, &apos;wiki.coldbox.org&apos;);return false;&quot;&gt;http://wiki.coldbox.org/&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
Most of the code you&apos;ll be utilizing is in either /handlers/dev/ or /model/objects/
&lt;br /&gt;&lt;br /&gt;
Also, I added a deleteContact example that wasn&apos;t covered in the presentation.  It should be pretty self explanatory.
&lt;br /&gt;&lt;br /&gt;
Lastly, this code is a basis to build on and should not be used in a production environment.  
&lt;br /&gt;&lt;br /&gt;
If you have any questions or problems, please leave a comment below.  
&lt;br /&gt;&lt;br /&gt;
&lt;a href=&quot;/files/ColdFusion-Railo-ORM-1.0.rar&quot; onClick=&quot;recordOutboundLink(this, &apos;Downloads&apos;, &apos;ColdFusion-Railo-ORM&apos;);return false;&quot;&gt;Download Source Code&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;img style=&quot;visibility:hidden;width:0px;height:0px;&quot; border=0 width=0 height=0 src=&quot;http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyODA5MDIwOTAxMjMmcHQ9MTI4MDkwMjA5MjkzNiZwPTEwMDA3NTImZD*mZz*yJm89YjhhYjkwY2Q*ZWZkNDNkN2I1/NmY3MjcwOTIyYjA2MzYmb2Y9MA==.gif&quot; /&gt;&lt;object height=&quot;425&quot; width=&quot;550&quot;&gt;
	&lt;param name=&quot;movie&quot; value=&quot;http://slidesix.com/viewer/SlideSixViewer.swf?alias=Object-Relational-Mapping-ORM&quot;/&gt;
	&lt;param name=&quot;menu&quot; value=&quot;false&quot;/&gt;
	&lt;param name=&quot;scale&quot; value=&quot;noScale&quot;/&gt;
	&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;
	&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot; /&gt;
	&lt;embed src=&quot;http://slidesix.com/viewer/SlideSixViewer.swf?alias=Object-Relational-Mapping-ORM&quot; allowscriptaccess=&quot;always&quot; allowFullScreen=&quot;true&quot; height=&quot;425&quot; width=&quot;550&quot; type=&quot;application/x-shockwave-flash&quot;  FlashVars=&quot;gig_lt=1280902090123&amp;gig_pt=1280902092936&amp;gig_g=2&quot;/&gt;
 &lt;param name=&quot;FlashVars&quot; value=&quot;gig_lt=1280902090123&amp;gig_pt=1280902092936&amp;gig_g=2&quot; /&gt;&lt;/object&gt;
&lt;br /&gt;&lt;br /&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>ORM</category>				
				
				<pubDate>Wed, 04 Aug 2010 03:53:00 -0400</pubDate>
				<guid>http://www.coldfusioning.com/index.cfm/2010/8/4/ColdFusion--Railo-Object-Relational-Mapping--ORM-Source-Code-and-Notes</guid>
				
			</item>
			
			<item>
				<title>Object Relational Mapping (ORM) in ColdFusion 9 and Railo Free Presentation</title>
				<link>http://www.coldfusioning.com/index.cfm/2010/8/2/Object-Relational-Mapping-ORM-in-ColdFusion-9-and-Railo-Free-Presentation</link>
				<description>
				
				Tomorrow night I will be presenting on using ORM with ColdFusion and Railo.  We&apos;ll be looking at the concepts behind ORM but will also be exploring code samples and practical, real-world utilization of ORM.
&lt;br /&gt;&lt;br /&gt;
The presentation will be in Tampa, FL and will also be offered via Adobe Acrobat Connect.  That&apos;s right, we&apos;ll be broadcasting live and accepting questions from remote attendees!  
&lt;br /&gt;&lt;br /&gt;
If you ever have wondered what ORM was and how you could use it or if you&apos;re already using ORM but would like to learn more and solidify your understanding, this is the presentation to attend.
&lt;br /&gt;&lt;br /&gt;
View more information or register over on &lt;a href=&quot;http://www.meetup.com/florida-web-developers/calendar/13819738/&quot;&gt;Meetup&lt;/a&gt;.
&lt;br /&gt;&lt;br /&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>ORM</category>				
				
				<pubDate>Mon, 02 Aug 2010 13:47:00 -0400</pubDate>
				<guid>http://www.coldfusioning.com/index.cfm/2010/8/2/Object-Relational-Mapping-ORM-in-ColdFusion-9-and-Railo-Free-Presentation</guid>
				
			</item>
			
			<item>
				<title>ColdFusion Now Supports Multiple Data Sources for ORM</title>
				<link>http://www.coldfusioning.com/index.cfm/2010/7/13/ColdFusion-Now-Supports-Multiple-Data-Sources-for-ORM</link>
				<description>
				
				With the ColdFusion 9.0.1 update, you can now use multiple data sources with ORM.  When you create your objects, use the &quot;datasource&quot; attribute to specify which each should use.  Below is an example of it in use:

&lt;code&gt;
component		persistent		= true
			accessors		= true
			entityname		= &apos;Contact&apos;
			hint			= &apos;This object holds contacts and their associated properties&apos;
			datasource		= &apos;mydatasource&apos; {

property name=&apos;ContactID&apos; type=&apos;numeric&apos; persistent=true ormtype=&apos;integer&apos; fieldtype=&apos;id&apos; generator=&apos;increment&apos;;
}
&lt;/code&gt;
&lt;br /&gt;
If you don&apos;t specify a data source, the default data source is used. 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>ORM</category>				
				
				<pubDate>Tue, 13 Jul 2010 16:05:00 -0400</pubDate>
				<guid>http://www.coldfusioning.com/index.cfm/2010/7/13/ColdFusion-Now-Supports-Multiple-Data-Sources-for-ORM</guid>
				
			</item>
			
			<item>
				<title>Introduction to ColdFusion ORM</title>
				<link>http://www.coldfusioning.com/index.cfm/2009/10/17/Introduction-to-ColdFusion-ORM</link>
				<description>
				
				After coming back from MAX and seeing how wonderful ORM is, I had to jump right into it.  I&apos;m using ORM for the Tour de ColdFusion so I will post some code samples as I write them. The first set is an introduction to ColdFusion ORM.
&lt;br /&gt;&lt;br /&gt;
The first thing you have to do is turn ORM on.  You do this simply by adding the two following lines to your Application.cfc:

&lt;code&gt;
&lt;cfset this.datasource = &quot;yourDataSourceName&quot; /&gt;
&lt;cfset this.ormEnabled = true /&gt;
&lt;/code&gt;
&lt;br /&gt;
The DataSource name must match the one you created in the ColdFusion Administrator that is correctly pointed at a database.  The next thing we&apos;ll do is define our table.  We&apos;re going to call this one Categories.cfc:

&lt;code&gt;
&lt;cfcomponent persistent=&quot;true&quot;&gt; 
  &lt;cfproperty name=&quot;CategoryID&quot;
	 	type=&quot;numeric&quot;
	 	validate=&quot;integer&quot;
	 	setter=&quot;false&quot;
	 	hint=&quot;I am the unique ID of the property.&quot;
	 	persistent=&quot;true&quot;
	 	fieldtype=&quot;id&quot;
	 	column=&quot;categoryid&quot;
	 	ormtype=&quot;integer&quot;
	 	generator=&quot;identity&quot;
	 	length=&quot;10&quot;
	/&gt; 
    &lt;cfproperty 
		name=&quot;CategoryName&quot;&gt; 
    &lt;cfproperty 
		name=&quot;ParentID&quot;&gt; 
    &lt;cfproperty 
		name=&quot;theOrder&quot;&gt; 
    &lt;cfproperty 
		name=&quot;Deleted&quot;&gt;
&lt;/cfcomponent&gt;
&lt;/code&gt;
&lt;br /&gt;
This defines the Unique ID named as Category that auto-increments.  We defined some other simple columns.  Next we&apos;re going to insert some data into the database:

&lt;code&gt;
&lt;cfscript&gt;
	newObj = EntityNew(&quot;Categories&quot;);
	newObj.setCategoryName(&quot;UI Controls&quot;); 
	newObj.setParentid(&quot;2&quot;); 
	EntitySave(newObj);
	writedump(newObj.getCategoryID()); 
	ormflush();
&lt;/cfscript&gt;
&lt;/code&gt;
&lt;br /&gt;
All this does is set the category name, parentid and saves it.  It also retrieves the new CategoryID from the database.  The last thing we&apos;re going to do is get some data back out of the database:

&lt;code&gt;
&lt;cfscript&gt;
   categories = EntityLoad(&quot;categories&quot;, true);
   writedump(categories);
&lt;/cfscript&gt;
&lt;/code&gt;
&lt;br /&gt;
This is very similar to doing except ORM loads and array rather than a query:

&lt;code&gt;
&lt;cfquery name=&quot;getCategories&quot;&gt;
SELECT * FROM Categories
&lt;/cfquery&gt;
&lt;cfdump var=&quot;#getCategories#&quot; /&gt;
&lt;/code&gt;
&lt;br /&gt;
Lastly, if you want to select a single record from the database you would use this code:

&lt;code&gt;
&lt;cfscript&gt;
   categories = EntityLoad(&quot;categories&quot;, 5, true);
   writedump(categories);
&lt;/cfscript&gt;
&lt;/code&gt;
&lt;br /&gt;
With &quot;5&quot; being the CategoryID of the record you want to pull from the database.
&lt;br /&gt;&lt;br /&gt;
ORM is truly a game-changer in the web development industry.  It is going to enable ColdFusion developers to create applications even faster than we could before.  I would recommend not waiting to learn it because it is only going to save you time in the long run.
&lt;br /&gt;&lt;br /&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>ORM</category>				
				
				<pubDate>Sat, 17 Oct 2009 00:19:00 -0400</pubDate>
				<guid>http://www.coldfusioning.com/index.cfm/2009/10/17/Introduction-to-ColdFusion-ORM</guid>
				
			</item>
			
			<item>
				<title>ColdFusion ORM:  Error while executing the Hibernate query - table is not mapped exception</title>
				<link>http://www.coldfusioning.com/index.cfm/2009/10/17/ColdFusion-ORM--Error-while-executing-the-Hibernate-query--table-is-not-mapped-exception</link>
				<description>
				
				I&apos;m starting to learn ORM and figured I&apos;d post some simple but confusing problems I&apos;ve run into.  The first is I kept getting the error:
&lt;br /&gt;&lt;br /&gt;
Error while executing the Hibernate query.&lt;br /&gt;
org.hibernate.hql.ast.QuerySyntaxException: tablename is not mapped 
&lt;br /&gt;
This was my ORM code:
&lt;code&gt;
&lt;cfset request.id = 0 /&gt;
&lt;cfscript&gt;
categories = ormExecuteQuery(&quot;from categories where ParentID = ?&quot;, [request.ID]); 
&lt;/cfscript&gt;
&lt;/code&gt;
&lt;br /&gt;
Apparently, because my cfc is named Categories.cfc and I didn&apos;t capitalize &quot;categories&quot; inside of the ormExecuteQuery, it was throwing the error.  If I cahnge it to: 
&lt;code&gt;
&lt;cfset request.id = 0 /&gt;
&lt;cfscript&gt;
categories = ormExecuteQuery(&quot;from Categories where ParentID = ?&quot;, [request.ID]); 
&lt;/cfscript&gt;
&lt;/code&gt;
&lt;br /&gt;
The code works.  A simple capitalization error that doesn&apos;t seem obvious because ColdFusion is largely not case sensitive.
&lt;br /&gt;&lt;br /&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>ORM</category>				
				
				<pubDate>Sat, 17 Oct 2009 00:15:00 -0400</pubDate>
				<guid>http://www.coldfusioning.com/index.cfm/2009/10/17/ColdFusion-ORM--Error-while-executing-the-Hibernate-query--table-is-not-mapped-exception</guid>
				
			</item>
			</channel></rss>