A week with ColdFusion ORM

So I’ve finally gotten an opportunity in work to use ColdFusion 9’s built-in ORM.

Initially I thought ORM wasn’t such a great thing. After mucking around with OJB for a few years (not my call) we eventually dropped the Java angle and rewrote all our beans/domain-objects in CF using a system of DAOs and Gateways that stand in for the persistence layer. We actually created a way for developers to create a DAO from a table. It was a one click thing, and to be honest I’m not sure we’d ever need anything else.

So then I was reading Grails in Action – doing a bit of programming cross-pollination – when I saw how Grails managed the data layer, using GORM (Grails ORM). I was impressed! It was simple, intuitive and I loved they way the data constraints (ranges, types etc.) were specified with the domain model. I seemed very…right.

With that I decided to look at how they handled these constraints with CF ORM. Well CF didn’t really allow for this type of constraint specification and validation. Not natively at least. I was disappointed.

But I then when discovered what Dan Vega had done to bring CF ORM up to scratch with Hyrule.  I was very impressed. This – while not as neat as the Grails way – was still a massive step in the right direction. Dan obviously knows what he’s doing and I’m delighted he outsourced the work he’s done.

So in the past few weeks we’ve kicked off a new project – a new web site – and we decided to use CF ORM + Hyrule from scratch (as well as Framework 1). It’s early days yet, but both are working out well.

CF ORM / Hibernate is a massive topic but I’m starting to see the beauty of having a 100% object-oriented approach. No cfquery tags at all (except for HQL but that’s given me some problems).

I had some concerns about using ORM, mostly around performance (since we are paranoid about that here in work!) but if you understand the basics of how CF ORM works you’ll soon be over that and flying.

So try out CF ORM – you might be impressed by what you discover.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to A week with ColdFusion ORM

  1. Dan Vega says:

    Glad it helped! I still have a lot of work to do with my validation framework but none the less it is one of my resolutions for the new year!

    • ciaranarcher says:

      Cheers Dan. We all have our resolutions 🙂 We finished that site BTW. I actually ended up tweaking your code some to cater for situations where I only wanted to validate *some* of the properties. Have you thought about creating a github.com project and accepting some contributions?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s