A warning for anyone who uses the “Disable type checking” in the ColdFusion administrator:
This one took me a long time to debug today… I have a “formbean” defined in my Transfer ORM configuration with a onetomany relationship named “Child” that references itself. This allows a parent-child relationship. I had a typo in my code today that looked like:
<cfset var formparent = "" />
...
<cfset formparenbt = getFormBean(id) />
<cfset formbean.setParentFormBean(formparent) />
Notice that because I fat-fingered the variable name, the actual value passed to setParentFormBean is the original var-scoped empty string. But it resulted in the Java error about “the method getClassName() could not be found or is overloaded…”.
It boils down to the second line in this snippet from the generated transfer file:
<cffunction name="setParentformbean" access="public" returntype="void" default="void" hint="Mutator for parent event.formbean" output="false">
<cfargument name="transfer" type="transfer.com.TransferObject" required="true" hint="the object to set as parent">
<cfargument name="loadChildren" type="boolean" required="false" hint="Expert/Transfer use only: whether or not to load the children." default="true">
<cfargument name="loadingFromMemento" type="boolean" required="false" hint="Expert/Transfer use only: if this is loading from a memento or not" default="false">
<cfscript>
if(arguments.transfer.getClassName() neq "event.formbean")
{
Now, had type checking not been disabled, the cfargument would have thrown an error indicating the object was NOT a proper transfer.com.TransferObject. Instead it continued to throw wild goose chase errors. Bollocks!
During development, do yourself a favor and leave type checking enabled!
Comments are closed.