CB3.5 beta: ORM problems

Hi Guys,

I have a problem with injection/ORM.

in my WireBox.cfc I have mapped the following:
map(“SupportMatch”).to(“model.ormEntities.SupportMatch”);

model.ormEntities.SupportMatch contains:

component persistent=“true” table=“SupportMatches”{

// Primary Key
property name=“SupportMatchID” fieldtype=“id” column=“SupportMatchID” generator=“identity”;

// Properties
property name=“SupportMatchConfirmed” ormtype=“boolean”;
property name=“SupportMatchDateConfirmed” ormtype=“timestamp”;
property name=“SupportMatchProcessed” ormtype=“boolean”;
property name=“SupportMatchDateProcessed” ormtype=“timestamp”;
property name=“UserID” ormtype=“integer”;

// Relations
property name=“Terminal” fieldtype=“one-to-one” cfc=“MerchantMatch” fkcolumn=“SupportQueueMerchantMatchID”;
property name=“Campaign” fieldtype=“one-to-one” cfc=“MerchantMatchCampaign” fkcolumn=“SupportQueueMerchantMatchCampaignID”;

// Constructor
function init(){
return this;
}
}

in the root of my model folder i have a file ORMEventHandler.cfc with content:

component extends=“coldbox.system.orm.hibernate.EventHandler”{

}

In a service layer component I have:
property name=“supportMatchService” inject=“entityService:SupportMatch”;

When calling a method in the service layer that calls:
var supportMatch = supportMatchService.new();

I get error:

Application Execution Exception
Error Type: Application : [N/A]
Error Messages: Mapping for component model.ormEntities.SupportMatch not found.
Either the mapping for this component is missing or the application must be restarted to generate the mapping.

This used to work before upgrading to 3.5 beta (it worked in 3.5 develop too)

Any idea’s?

Yes check out the what’s new. The auto wire interceptor got deprecated. You must tell the app to inject entities instead of the auto wire interceptor

Thanks Luis,

I’ll go check it out and will let you know if I get stuck :wink:

Cheers,
Tom

Hi Guys,

It has to be something else I think. I updated everything according to the what’s new doc: removed Autowire from my interceptors, added

orm = {
	injection = {
		enabled = true,
		include = "",
		exclude = ""	
	}	
};

to my coldbox.cfc

All my entities work, as long as I don’t try to save them.

//All of this works
var supportMatch = supportMatchService.new();
supportMatch.setTerminal(merchantMatchService.get(merchantMatchID));
supportMatch.setCampaign(campaignMerchant);
supportMatch.setSupportMatchConfirmed(merchantMatchConfirmed);
supportMatch.setSupportMatchDateConfirmed(now());
supportMatch.setSupportMatchProcessed(false);
supportMatch.setUserID(user.id);

//Here is where it goes wrong
supportMatchService.save(supportMatch);

Then it throws an error on line 700 of coldbox\system\orm\hibernate\BaseORMService.cfc

Application Execution ExceptionError Type: Application : [N/A]

Error Messages: Mapping for component model.ormEntities.SupportMatch not found.
Either the mapping for this component is missing or the application must be restarted to generate the mapping.

Tag Context:
ID: CF_CFPAGE
LINE: 700
Template: E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc
ID: CF_UDFMETHOD
LINE: 1130
Template: E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc
ID: CF_UDFMETHOD
LINE: 686
Template: E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc
ID: CF_TEMPLATEPROXY
LINE: 155
Template: E:\WWW\Live\MatchingGame\model\randomMerchantMatch\Service.cfc
ID: CF_TEMPLATEPROXY
LINE: 45
Template: E:\WWW\Live\MatchingGame\handlers\RandomMerchantMatch.cfc
ID: CFINVOKE
LINE: 698
Template: E:\WWW\Live\ColdBox\system\web\Controller.cfc
ID: CF_UDFMETHOD
LINE: 583
Template: E:\WWW\Live\ColdBox\system\web\Controller.cfc
ID: CF_TEMPLATEPROXY
LINE: 223
Template: E:\WWW\Live\ColdBox\system\Coldbox.cfc
ID: CF_UDFMETHOD
LINE: 338
Template: E:\WWW\Live\ColdBox\system\Coldbox.cfc
ID: CF_TEMPLATEPROXY
LINE: 93
Template: E:\WWW\Live\MatchingGame\Application.cfc
Framework Snapshot
Current Event: RandomMerchantMatch.submitMatch
Current Layout: N/A (Module: )
Current View: N/A
Bug Date: 12/08/2011 08:46:31 AM
Coldfusion ID: CFID=1170091 ; CFToken=329841e91dc9622a-1C3A0270-C255-6D66-50A94E2D7A920C52 ; JSessionID=0A9B27CCB5DB20100D681353B21279AD_1170091_329841e91dc9622a-1C3A0270-C255-6D66-50A94E2D7A920C52
Template Path : E:\WWW\Live\MatchingGame\index.cfm
Path Info : /RandomMerchantMatch/submitMatch
Host & Server: game.tutuka.com partagas
Query String:
Referrer: http://game.tutuka.com/index.cfm/RandomMerchantMatch/index
Browser: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
Remote Address: 192.168.0.236
Form variables:
MERCHANTMATCHCAMPAIGNID: 46802
MERCHANTMATCHID: 1515
ACTIONTYPE: 0
Session Storage:
Cookies:
SESSID: 1.5J ,7
HOSTID: 7,6ca66f aa611b7-1ACF5 51-9JC5-75JA-7C1AAC6A5B1.17CC
__utma: 256051613.942807402.1322035921.1323248421.1323253665.4
__utmz: 256051613.1322035921.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
COLDBOX_DEBUGMODE_C0205970260E2CA8D07CB96AF198AC63: true
USERNAME: “tom”
ID: 0E4EA9E7C522D7D2ACE6D6D718ED98F62F8F87DEE0D4C108E4E3B0DE67CF01CC0CF070FF4E52CA28B2D94B1208EE94F5A8881573127BE6056F9813FD
CFID: 1170091
CFTOKEN: 329841e91dc9622a-1C3A0270-C255-6D66-50A94E2D7A920C52
Stack Trace:

coldfusion.orm.EntityMappingNotFoundException: Mapping for component model.ormEntities.SupportMatch not found.
	at coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:135)
	at coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:128)
	at coldfusion.orm.ORMUtils.entitySave(ORMUtils.java:195)
	at coldfusion.runtime.CFPage.EntitySave(CFPage.java:7753)
	at cfBaseORMService2ecfc429667279$func$SAVE.runFunction(E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc:700)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2309)
	at cfBaseORMService2ecfc429667279$func$TRANSACTIONED.runFunction(E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc:1130)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
	at cfBaseORMService2ecfc429667279$funcSAVE.runFunction(E:\WWW\Live\ColdBox\system\orm\hibernate\BaseORMService.cfc:686)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
	at cfService2ecfc1225098535$funcSUBMITMATCH.runFunction(E:\WWW\Live\MatchingGame\model\randomMerchantMatch\Service.cfc:155)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
	at cfRandomMerchantMatch2ecfc1662599475$funcSUBMITMATCH.runFunction(E:\WWW\Live\MatchingGame\handlers\RandomMerchantMatch.cfc:45)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301)
	at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:389)
	at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2723)
	at cfController2ecfc2054798715$funcINVOKER.runFunction(E:\WWW\Live\ColdBox\system\web\Controller.cfc:698)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
	at cfController2ecfc2054798715$funcRUNEVENT.runFunction(E:\WWW\Live\ColdBox\system\web\Controller.cfc:583)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301)
	at cfColdbox2ecfc1556301076$funcPROCESSCOLDBOXREQUEST.runFunction(E:\WWW\Live\ColdBox\system\Coldbox.cfc:223)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
	at cfColdbox2ecfc1556301076$funcONREQUESTSTART.runFunction(E:\WWW\Live\ColdBox\system\Coldbox.cfc:338)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
	at cfApplication2ecfc688406135$funcONREQUESTSTART.runFunction(E:\WWW\Live\MatchingGame\Application.cfc:93)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
	at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
	at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
	at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
	at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
	at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
	at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
	at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:88)
	at coldfusion.runtime.AppEventInvoker.onRequestStart(AppEventInvoker.java:258)
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:349)
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
	at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
	at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
	at coldfusion.CfmServlet.service(CfmServlet.java:200)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
	at com.intergral.fusionreactor.filter.FusionReactorFilter.b(FusionReactorFilter.java:376)
	at com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:254)
	at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:164)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at jrun.servlet.FilterChain.service(FilterChain.java:101)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Extra Information Dump
[N/A]

Ah ok. This is a cf error then not a ColdBox one.

Try to create a / mapping pointing to your root application. Cf is iffy there

I have the same problem. Even mapped in wirebox, the to be injected
entities cannot be found.

Did all the Handler stuff, coldbox.cfc config etc.

And why would I need for this a mapping for "/" this would crash all
other mappings like /coldbox etc. won't it?

This is a ColdFusion issue not a CB issue. I have come across this in ACF on embedded applications for some reason. Where entities cannot be found, very weird one. I have solved it by creating either a “/” mapping or a “/myMapping” to point to the root and use that.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Thanks for the hint, but it seems to be still something else.

I created this mapping in Application.cfc (composition)
<cfset this.mappings["/fb"] =
GetDirectoryFromPath( GetBaseTemplatePath() ) />

I used this mapping before (which works for everything but injection
into orm objects):
<cfset this.mappings["/model"] =
GetDirectoryFromPath( GetBaseTemplatePath() ) & "model/" />

I use this in orm config:
eventhandling = 'true',
eventhandler = 'model.eventhandler.ORMEventHandler',

The event handler looks like:
<cfcomponent extends="coldbox.system.orm.hibernate.EventHandler">
</cfcomponent>

The coldbox config has this:
    orm = {
      injection = {
        enabled = true
        include = '',
        exclude = ''
      }
    };

The orm object:
<cfcomponent table="myTable" persistent="true" output="false"
extends="coldbox.system.orm.hibernate.BaseORMService" cacheuse="read-
write" cachename="fb1" >
  <!---DI properties--->
  <cfproperty name= "EncryptionService" inject =
"fb.model.service.EncryptionService" scope = "this" persistent =
"false" />
Or:
  <cfproperty name= "EncryptionService" inject =
"model.service.EncryptionService" scope = "this" persistent = "false" /

Or:
  <cfproperty name= "EncryptionService" inject = "EncryptionService"
scope = "this" persistent = "false" />

the usage in the object would be something like this:
<cffunction name="getTitel" access="public" output="false"
returntype="string">
    <cfreturn this.EncryptionService.decrypt(variables.titel) />
</cffunction>

After all this i get the message:
Component [myORMobject] has no acessible Member with name
[ENCRYPTIONSERVICE]

If create the object in the constructor it works well:

<cffunction name="init" access="public" returntype="myORMobject"
output="false" hint="Constructor">
  <cfscript>
    this.EncryptionService = CreateObject("component",
"fb.model.service.EncryptionService");
    return this;
  </cfscript>
</cffunction>

Since even the coldbox property injection for dsn throws an error,
it's not depending to the path but the autowiring itself:
<cfproperty name = "dsn" inject = "coldbox:datasource:mysite"
scope = "instance" persistent = "false" />

Any further ideas would be appreciated.

Regards
Markus

Markus,

Can you enable logging so you can see what is going on with the DI. You can add a file or debugger appender in your ColdBox.cfc and use something like this to get debug data from WireBox:

debug = [“coldbox.system.ioc”]

Then we can see if the entities are being wired or not.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

When activating logbox i get a lot of "coldbox.system.ioc.*" messages
but none does refer to an injection into the orm object.
If i wire the same object to a handler, everything works fine.

Can you compare the setting s in this app as I use entity injection extensively.