28 July 2009 08:41 AM
Updated Sample Code for Introduction to CF9 ORM DevNet Article
My apologies if this is a little belated, but here is an update to the sample code that was posted with my DevNet article Introducing ORM in Adobe ColdFusion 9 beta.
Unfortunately several things changed in CF9 between the time that I wrote the article and when the public beta came out.
The major differences between the sample on Adobe.com and this one are:
- The datatype attribute on cfproperty was changed to ormtype.
- Disable Implicit UDF Registration is now turned on by default, so any implicit setter/getter inside a CFC has to be prefixed by 'this.' for them to function.
I will endeavour to keep this download up to date as new versions of ColdFusion 9 are release.






Comments
Posted by Brian Love on 30 July 2009 03:19 AM
This is great, except that you need to use the this scope for onMissingMethod to fire. For example, we have a <cfproperty> tag that defines the relationship between two bean objects. We use onMissingMethod to enable implicit getters and setters, however, the this scope must be used for onMissingMethod to fire; catch 22. The only way around it is to use getter="false" and setter="false" on all <cfproperty> tags. Can we get an application level setting to disable implicit getter and setter methods all together?
Posted by Al Anderson on 07 August 2009 10:45 AM
I get an error: An association from the table musician_instrument refers to an unmapped class
When I access the 01_createmusician.cfm
What have I missed?
Thank you,
Al
Posted by Mark on 07 August 2009 01:01 PM
@Al,
I will need more information than that.
What path are you running the examples from? (they were designed to be in the root of your application.
The details of the error would also help.
Posted by Austin on 01 October 2009 03:35 PM
Hi Mark,
i am getting the same error as Al. I thought it would be useful to others facing the same difficulty to post the full error. I hope this may help you propose the solution. I am running the file 01_createmusician.cfm from the application root. I am able to get some other orm samples to run on my machine, but this one has me stumped! Anyway, thanks for the great article. If you manage to find time to suggesta solution I would be obliged, but if not as they say Down Under "No worries" I'm sure I'll work it out with a better understanding of ORM!
An association from the table musician_instrument refers to an unmapped class:
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.0 Safari/532.0
Remote Address 0:0:0:0:0:0:0:1
Referrer
Date/Time 01-Oct-09 06:06 AM
Stack Trace
org.hibernate.MappingException: An association from the table musician_instrument refers to an unmapped class:
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1285)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1203)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:789)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at coldfusion.orm.hibernate.HibernateConfiguration.exportSchema(HibernateConfiguration.java:341)
at coldfusion.orm.hibernate.HibernateConfiguration.initHibernateConfiguration(HibernateConfiguration.java:218)
at coldfusion.orm.hibernate.HibernateConfiguration.<init>(HibernateConfiguration.java:138)
at coldfusion.orm.hibernate.ConfigurationManager.initConfiguration(ConfigurationManager.java:69)
at coldfusion.orm.hibernate.HibernateProvider.InitializeORMForApplication(HibernateProvider.java:168)
at coldfusion.orm.hibernate.HibernateProvider.beforeApplicationStart(HibernateProvider.java:83)
at coldfusion.filter.ApplicationFilter.fireBeforeAppStartEvent(ApplicationFilter.java:422)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:209)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
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:53)
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:386)
at com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:264)
at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:174)
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.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Posted by Mark on 16 October 2009 10:20 AM
All,
Just updated the example to (a) fit in with some of the new CF9 features, and also to fix the folder structure, and hopefully resolve the 'unmapped' class issue.
This has also been sent to devnet to update the article as well.
Posted by Austin on 16 October 2009 10:25 PM
Thanks man!
Posted by Patrick Heppler on 09 January 2010 06:41 AM
@Al and Austin
i got the same error. The problem is very easy.
<cfproperty name="instruments" hint="Array of instruments" singularname="instrument"
fieldtype="many-to-many" collectiontype="array" cfc="com.Instrument"
linktable="musician_instrument" FKColumn="musicianID" inversejoincolumn="instrumentID"
orderby="name">
The cfc attribute pints to com.Instrument! But both cfcs are stored in com so the cfc attribute has to point to Instrument only. Worked for me.