I'm using ColdFusion Builder beta 2 on my current CF project. It's been stable and working well (quirks here and there, sure, but totally usable). As we add new features to the application, I use the Adobe CFC Generator extension to create the basic CFCs I want for CRUD operations, later extending them to do other tasks. 

Every now and again, I'd go to generate the CFCs from a DB table and the CFC generator extension would only create a value object and a DAO; no Gateway or Service classes. 

I spent nearly an hour either googling for a solution or deleting the auto-generated CFCs and running the generator over and over ( what's that definition of insanity again :)? ). Finally, it dawned on me. The tables that successfully created all four CFCs (value object, DAO, gateway, and service) had one thing in common: a primary key. Duh! 

The point of this uninspired post is to note if you find the Adobe CFC Generator extension is not generating all the files you'd expect for a selected table, make sure the table has a primary key! 

Posted via email from Craig Kaminsky's posterous

Comments

Colin
Hey Craig, just so you know because you told me about Apache and stuff. I did major research, downloadd SQL server, new MySQL Workbench, Navicat and other tools. Took my time to test them all. I did a bunch of importing and exporting... cut the quick. Yes I got my very MS Access DB to generate after and only after I exported to MySQL. Its a shame really I wasn't ready to move on to MySQL until I was finished testing but I was forced to do so simply because as cute as Access is to design its capabilities are bit too limited :( But THANKS AGAIN Graig. Your blog did help. Now I guess its safe to further explain why CF Builder cant generate CFCs in certain cases. DATABASE COMPATIBILITY! :)
Craig Kaminsky
My pleasure, Colin! I know what you mean about being able to design DBs more visually. I recently started using SQLEditor (I think it's Mac-only) and it's freaking awesome. I can visually design my tables and it creates the CREATE TABLE syntax (with foreign keys, etc.) for me. I then copy/paste that into whatever my production DB is, which is typically MySQL or MS SQL Server 2008. Pretty cool tool and, so far, worth the few bucks I spent on it.

Anyway, enough rambling! Thanks, again, for reading the post/blog, let along bookmarking it ;)!
Colin
Thanks a lot Craig. I will try Apache because the only reason I use Access is because I have it and its I don't need to mention it has stupendous design features. I love building my databases in access. It looks really cool but in the end its really a pain to export to any other database except Microsoft's SQL Server. Its really important to have as testing platform for testing queries. I still sorta hate how it writes sql. Im a big fan of "write less...do more" and access writes a lot of unnecessary code. Anyway, Thanks again Craig, You were a great help. I totally bookmarked this page :)
Craig Kaminsky
Ugh. Forgot to add the link and a note on why I mentioned Derby. Sorry!

Apache Derby: http://db.apache.org/derby/

Derby is the "new" Adobe CF default DB that you mentioned in your most recent comment.
Craig Kaminsky
@Colin: doesn't seem strange at all :)! I've got my own "wonky" development practices and processes!

Access is such a different beast, eh? When I was on Windows, I often encountered some Access odd-ness.

One thing that might be worth exploring is to use Apache Derby first and then migrate to MySQL when ready. I've read some good things on Derby and it might match better with MySQL in terms of features, etc. Anyway, just a thought!
Colin
Craig I'm starting to think its my DB thats causing the issue. I'm using Access. And I tried generating CFC's using the coldfusion's default DB and it works fine. I even tried switching up my primary keys. NO LUCK! I usually test w/t Access and export to MySQL. I like to solve an issue b4 I move on to MySQL u know. I know, a little strange but that way works me :)
Craig Kaminsky
Thanks for the comments, guys. Colin: sorry to hear about your issue. I have not run into that situation just yet. I'll mess around this weekend and see if I can reproduce. What DB are you using?
Colin
U know. I have the very same issue. It turns out your discovery isn't quite right because I don't create tables without primary keys but CFbuilder still won't generate gateway CFCs. Sup with that.
ilia
Thank you!