ORM Entity Injection
Custom ORM Event Handler
this.ormSettings = {
cfclocation="model",
dbcreate = "update",
dialect = "MySQLwithInnoDB",
logSQL = true,
// Enable event handling
eventhandling = true,
// Set the event handler to use, which will be inside our application or the default wirebox one
eventhandler = "model.ORMEventHandler"
};component implements="CFIDE.orm.IEventHandler"{
{% hint style="info" %}
WireBox uses a per-request transient injection cache by default, so repeated `autowire()` calls for the same entity mapping during a request reuse the resolved injections and delegations. You can disable this globally via `transientInjectionCache` or per-entity with the `transientCache="false"` annotation.
{% endhint %}
/**
* postLoad called by hibernate which in turn announces a coldbox interception: ORMPostLoad
*/
public void function postLoad(any entity){
application.wirebox.autowire(
target=arguments.entity,
targetID="ORMEntity-#getMetadata( arguments.entity ).name#"
);
}
}Last updated
Was this helpful?