Coldfusion 9, ORM, Inserting Null Values

I have a little app to write and I decided to use the opportunity to learn some ORM.   I use the same form when I add or edit  an item.  The only difference is that edited values have a pre-set ID identity  field / column.

The problem I ran into was when I submitted the form as an "ADD" the field was empty.  I set the ID to an empty string and when I tried to save it got the error

The value '' cannot be converted to a number.

The solution was simple,  in my form processing I just did the following:

<cfif isnumeric(form.MeasureId)>
<cfset measures.setMeasureId(form.MeasureId)  />

If no identity field is provided, it looks like ORM decides it's an insert.

No comments: