Copy link to clipboard
Copied
Hello my friend , im using coldfusion 9;
Firstly How can i enabled ORM ?
im have application.cfm file and i convert application.cfm file to application.cfc code is below,
Application.cfc
<cfcomponent output="false">
<cfscript>
this.name = "test";
this.sessionManagement = "Yes";
this.sessionTimeout = CreateTimeSpan(0,0,20,0);
this.setClientCookies = "Yes";
this.clientmanagement="yes";
</cfscript>
<cffunction name="onRequestStart">
<cfargument name="requestname" required=true />
<cfscript>
this.ormEnabled = true;
this.datasource="test_dsn";
this.dbcreate="none";
include "Application.cfm";
return true;
</cfscript>
</cffunction>
</cfcomponent>
USER.CFC
<cfcomponent persistent="true">
<cfproperty name="EMPLOYEE_ID" fieldtype="id" generator="native" />
<cfproperty name="EMPLOYEE_NAME" />
<cfproperty name="EMPLOYEE_EMAIL" length="200" />
</cfcomponent>
TEST_ORM.CFM
<cfscript>
ORMReload();
WriteDump( EntityLoad("user"));
</cfscript>
and
İ execute test_orm.cfm given error;
ORM is not configured this application
How can i solve this problem?
Copy link to clipboard
Copied
<cfcomponent output="false">
<cfscript>
this.name = "test";
this.sessionManagement = "Yes";
this.sessionTimeout = CreateTimeSpan(0,0,20,0);
this.setClientCookies = "Yes";
this.clientmanagement="yes";
this.ormEnabled = true;
this.ormsettings={datasource="test_dsn", dbcreate="none"};
</cfscript>
</cfcomponent>