I've been doing a lot with ColdFusion 9 and ORM lately and I've run into an interesting little problem. Look at the code block below and see if you can find the error(s):
component persistent="true" table="ARTISTS" {
property name="id" fieldtype="id";
property name="firstname" dbtype="string";
property name="lastname" dbtype="string";
property name="address" sqltype="string";
property name="city" sqltype="string";
property name="state" sqltpye="string";
}
There are three things wrong with this code, but CFBuilder will not flag any of them. Nor will ColdFusion complain when you use the entity. So what's wrong?
cfproperty (along with a few other tags) are "magic" within ColdFusion. By magic I mean that they allow you to pass any and all arguments. I could have easily used ray="fat" to the cfproperty tags and it would compile just as nicely. Normally this isn't such a big deal, but ORM adds something like 50(!!) new arguments that have special meaning to cfproperty. With so many new arguments it is easy to make a mistake.
The first thing I did wrong above was to use dbtype. ORM lets you specify either a generic database type (ormtype), or a specific type. When I began writing the code above I thought the specific argument was dbtype. But in reality, it is sqltype. My code wouldn't throw an error, and since I was using the default anyway it wouldn't be a huge big deal, but as you can guess, such a mistake could end up with unexpected results.
The second issue is more subtle. Notice the typo? I said sqltpye instead of sqltype. Again - this is not something that would throw an error in ColdFusion or be flagged in CFBuilder. So what I did was to create a new extension called ORM Scanner. ORM Scanner will scan all your ORM entities and compare the arguments to your cfproperty tags against the ginormous (that's a technical term) of "accepted" ORM attributes. Given the CFC above, here is the result.

Is this useful? I've attached the extension below. I'll be posting it to RIAForge a bit later today.
Archived Comments
Nice. I'm making typos like that alot, and without the IDE flagging them up, you could spand ages figuring it out. I like that it's easy to knock up these extensions in builder, and suspect that will end up being it's biggest strength
Hello!
Can not install this extension. Get an error: "Installation Error: null".
What I'm doing wrong?
Are you using CFB Final? Ah - I think I know what it is. I zipped it wrong. Unzip it, and then use the IMPORT option, not the install option. Import lets you point to a folder.
No, I'm still using the last RC. Import was successful. Thanks for extension! :)
This is really awesome. Really awesome time saver. Thanks mucho.
The extension zip problem finally prompted me to blog about this issue: http://www.terrenceryan.com...
I can't find this on RIA Forge has it been removed or am I missing something?
I never posted it. I was supposed to, wasn't I?
Forgot again. Here we go:
http://ormscanner.riaforge....
Ray, Thanks for that. I want to use it for my CFUG presentation this month.