ormReload

Reinitializes ORM for the application.If you make any change to the persistent metadata of the CFCs, then you might want to reload the ORM. Returns ORM session factory instance

ormReload() → returns void

Examples sample code invoking the ormReload function


Reload ORM by calling ormReload onRequestStart

Reloads the ORM of an application when ?ORMReload is in the URL. This is recommeded ONLY for development and should be removed from production.

component { 
	this.name = hash(getCurrentTemplatePath()); 
	this.datasource = "somedatasourceORM"; 
	// turn on ORM for this applicaiton
	this.ormenabled = true; 
	public boolean function onRequestStart(required string targetPage) {
		//if ormreload is in the URL, then reload ORM
		if (structKeyExists(url,"ormreload")){
			ORMReload()
		}
		return true;
	}
}

Expected Result: string


Fork me on GitHub