Adobe should be making ColdFusion 9 ORM easier

It is no secret that I don't like the current implementation, and it's not because it is hard to learn. But Adobe have made our work harder than they really could have.

First lets look at how Adobe have forced us to enter a many to many relationship, and how this works.

Accounts.cfc
property name="Roles" fieldtype="many-to-many" CFC="Role" linktable="Account_Role" FKColumn="username" inversejoincolumn="name" lazy="true" cascade="all";

Roles.cfc
property name="Accounts" fieldtype="many-to-many" CFC="Account" linktable="Account_Role" FKColumn="name" inversejoincolumn="username" lazy="true" cascade="all";

What this does is creates an extra table with the mapping of the primary keys needed for this to work. Basically what I have done is told CF-ORM to create a table named Account_Role that holds the relationships, set it to laxy loading, cascade all and set the FKColumn to the primary key of the related persistent component.

As you can see there is a hell of a lot of properties to remember here, and what they do.

What ColdFusion 9 ORM needs is a more basic, general approach that defaults to certain conditions to get it up and running. If you don't like this then you should be able to substitute just one or more of the default options to override that setting.

So with that in mind how should it look.

Accounts.cfc
property name="Roles" fieldtype="many-to-many" cfc="Role"
Roles.cfc
property name="Accounts" fieldtype="many-to-many" cfc="Account"

This would then make life a bit easier, and would mean your not running around in loops trying to get it to work. The basic idea here is that the defaults would assume that an extra table of Account_Role be created with the primary key of each persistent component, with generated FK's to match.

This would be extremely easier to remember, and as time goes on once the developer felt more comfortable they could substitute , say the linktable to override what is generated by ColdFusion or they could add the FKColumn to override that, or even both.

Adobe can do a lot more work in this area, and I hope that we begin to see this and some other enhancements to make the life of the developer easier and not harder. From a novice point of view, the current implementation is confusing and hard to grasp if you are not familiar with it. So Adobe please take a stance of making life easier to get up and running, not harder.