Element APPLICATION.ORM is undefined in a Java object of type class ERROR

Converting a huge application from Reactor to CF ORM, this error turned up during a conversion of a cffunction.

Element APPLICATION.ORM is undefined in a Java object of type class [Ljava.lang.String; referenced as ''

Here's the original function (notice the preceding "q" denoting a query):

view plain print about
1<cffunction name="getqAuthenticationPackages" access="public" hint="return query recordset of authentication packages">
2    <cfscript>
3    return variables.Reactor.createGateway("AuthenticationPackage").getAll();
4    
</cfscript>    
5</cffunction>

Here is the new function which produced the error:

view plain print about
1<cffunction name="getaAuthenticationPackages" access="public" hint="return query recordset of authentication packages">
2    <cfscript>
3    //return variables.Reactor.createGateway("AuthenticationPackage").getAll();
4
    return variables.application.ORM.createEntity("AuthenticationPackage").loadAll("AuthenticationPackage");
5    
</cfscript>    
6</cffunction>

Two things to notice here are:

  1. The preceding "q" has been replaced by an "a". ORM returns everything as an array, so we have to convert all our associated functions to work with the returned data as an array.
  2. The scope of the ORM.creatEntity() call. This is what produced the error. Remove the "variables" scope reference, so the call is made from the actual "application" scope.

Final working function:

view plain print about
1<cffunction name="getaAuthenticationPackages" access="public" hint="return query recordset of authentication packages">
2    <cfscript>
3    return application.ORM.createEntity("AuthenticationPackage").loadAll("AuthenticationPackage");
4    
</cfscript>    
5</cffunction>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Blog Owner