Does anyone know what causes "Cannot extend unmapped class" error?

I am trying to add a new entity to my ORM.

I am getting the error message “lucee.runtime.exp.NativeException: Cannot extend unmapped class”

The class mentioned has already been extended by other components but it does not like my new one but I have no idea why.

Kevin

Hi!!!.Can you post the full stack trace pls?

Googling the error, sounds like the sub class is ORM-mapped, but the base class is not?

But as @andreas alludes to… yer not exactly giving us much to go on here…

Code, stack track, what troubleshooting you’ve already done, etc…?

I didn’t even know where to start with this one so that’s what I was looking for. I am using Hibernate ORM for the first time. Only ever used cfquery before now. :slight_smile:

To provide some background I am using contentbox and wanted to extend the BaseContent.cfc to create a new Media.cfc of my own. The new component is in a plug-in that I am writing to handle photographs and other media for a personal website for my photography.

After posting this I read on a hibernate forum that the error could be caused when the new object is not in the same directory as the object it is extending. In this case the CFCs are different directories and I assume that means the generated java is in different directories. So maybe that is the issue.

It looks like the Base class is mapped to me, but I may be wrong. It’s definition is:

component
persistent =“true”
entityname =“cbContent”
table =“cb_content”
extends =“contentbox.models.BaseEntityMethods”
cachename =“cbContent”
cacheuse =“read-write”
discriminatorColumn=“contentType”
{…}

This is what appears in the Error Message:

Lucee 6.0.0.585 Error (org.hibernate.MappingException)
Message Cannot extend unmapped class cbContent
Entities cbPermissionGroup, cbRelocation, cbCategory, cbMediaMenuItem, cbModule, cbSubMenuItem, cbLoginAttempt, cbPermission, cbSubscriber, cbAuthor, cbContentVersion, cbMedia, cbSetting, cbContent, cbContentMenuItem, cbRole, cbPage, cbJSMenuItem, cbContentTemplate, cbSite, cbStats, cbFreeMenuItem, cbComment, cbURLMenuItem, cbEntry, cbMenuItem, cbMenu, cbContentStore, cbSecurityRule, cbCommentSubscription, cbCustomField, cbSubscription
_Datasource madaboutphoto
Stacktrace The Error Occurred in
C:\lucee\tomcat\webapps\ROOT\Application.cfc: line 174

172: pagePoolClear();
173: }
174: ormReload();
175: }
176:

Java Stacktrace lucee.runtime.exp.NativeException: Cannot extend unmapped class cbContent
at org.hibernate.cfg.HbmBinder.getSuperclass(HbmBinder.java:2737)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:176)
at org.hibernate.cfg.Configuration.add(Configuration.java:771)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:542)
at org.lucee.extension.orm.hibernate.HibernateSessionFactory.createConfiguration(HibernateSessionFactory.java:147)
at org.lucee.extension.orm.hibernate.SessionFactoryData.setConfiguration(SessionFactoryData.java:194)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.getSessionFactoryData(HibernateORMEngine.java:191)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.reload(HibernateORMEngine.java:98)
at lucee.runtime.config.ConfigImpl.resetORMEngine(ConfigImpl.java:3049)
at lucee.runtime.config.ConfigWebImpl.resetORMEngine(ConfigWebImpl.java:654)
at lucee.runtime.orm.ORMUtil.resetEngine(ORMUtil.java:74)
at lucee.runtime.functions.orm.ORMReload.call(ORMReload.java:40)
at application_cfc$cf.udfCall(/Application.cfc:174)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:446)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:137)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2494)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2480)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2451)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1219)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1165)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at mod_cfml.core.invoke(core.java:180)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:422)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.MappingException: Cannot extend unmapped class cbContent
… 54 more

In the stderr log:

2023-11-27 09:47:27 modules.contentbox.config.Scheduler The task (login-tracker-rotation) failed to executed. Caused by: Error building: CriteriaBuilder@cborm → Cannot extend unmapped class cbContent .DSL: none; Path: cborm.models.criterion.CriteriaBuilder; Error Location: C:\lucee\tomcat\webapps\ROOT\modules\contentbox\modules\contentbox-deps\modules\cborm\models\util\LuceeORMUtil.cfc:19
C:\lucee\tomcat\webapps\ROOT\modules\contentbox\modules\contentbox-deps\modules\cborm\models\criterion\CriteriaBuilder.cfc:82 | ExtraInfo: lucee.runtime.exp.CustomTypeException: Error building: CriteriaBuilder@cborm → Cannot extend unmapped class cbContent .
at lucee.runtime.tag.Throw._doStartTag(Throw.java:224)
at lucee.runtime.tag.Throw.doStartTag(Throw.java:211)
at throw_cfm$cf.udfCall(/throw.cfm:15)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
at lucee.runtime.functions.system.CFFunction.call(CFFunction.java:109)
at system.ioc.builder_cfc$cf.udfCall2(/coldbox/system/ioc/Builder.cfc:298)
at system.ioc.builder_cfc$cf.udfCall(/coldbox/system/ioc/Builder.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at system.ioc.injector_cfc$cf.udfCall2(/coldbox/system/ioc/Injector.cfc:610)
at system.ioc.injector_cfc$cf.udfCall(/coldbox/system/ioc/Injector.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at system.ioc.scopes.noscope_cfc$cf.udfCall(/coldbox/system/ioc/scopes/NoScope.cfc:43)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at system.ioc.injector_cfc$cf.udfCall2(/coldbox/system/ioc/Injector.cfc:581)
at system.ioc.injector_cfc$cf.udfCall(/coldbox/system/ioc/Injector.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.baseormservice_cfc$cf.udfCall8(/cborm/models/BaseORMService.cfc:1920)
at models.baseormservice_cfc$cf.udfCall(/cborm/models/BaseORMService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:702)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:597)
at lucee.runtime.SuperComponent.callWithNamedValues(SuperComponent.java:93)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1796)
at models.virtualentityservice_cfc$cf.udfCall3(/cborm/models/VirtualEntityService.cfc:394)
at models.virtualentityservice_cfc$cf.udfCall(/cborm/models/VirtualEntityService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:787)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.siteservice_cfc$cf.udfCall2(/contentbox/models/system/SiteService.cfc:203)
at models.system.siteservice_cfc$cf.udfCall(/contentbox/models/system/SiteService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.settingservice_cfc$cf.udfCall3(/contentbox/models/system/SettingService.cfc:535)
at models.system.settingservice_cfc$cf.udfCall(/contentbox/models/system/SettingService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:787)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.settingservice_cfc$cf.udfCall3(/contentbox/models/system/SettingService.cfc:511)
at models.system.settingservice_cfc$cf.udfCall(/contentbox/models/system/SettingService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.EnvUDF.call(EnvUDF.java:119)
at lucee.runtime.type.scope.ArgumentImpl.call(ArgumentImpl.java:519)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at system.cache.abstractcacheboxprovider_cfc$cf.udfCall3(/coldbox/system/cache/AbstractCacheBoxProvider.cfc:407)
at system.cache.abstractcacheboxprovider_cfc$cf.udfCall(/coldbox/system/cache/AbstractCacheBoxProvider.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.settingservice_cfc$cf.udfCall2(/contentbox/models/system/SettingService.cfc:514)
at models.system.settingservice_cfc$cf.udfCall(/contentbox/models/system/SettingService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:787)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.settingservice_cfc$cf.udfCall2(/contentbox/models/system/SettingService.cfc:473)
at models.system.settingservice_cfc$cf.udfCall(/contentbox/models/system/SettingService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:787)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.system.settingservice_cfc$cf.udfCall2(/contentbox/models/system/SettingService.cfc:415)
at models.system.settingservice_cfc$cf.udfCall(/contentbox/models/system/SettingService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at models.security.logintrackerservice_cfc$cf.udfCall(/contentbox/models/security/LoginTrackerService.cfc:91)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at modules.contentbox.config.scheduler_cfc$cf.udfCall(/modules/contentbox/config/Scheduler.cfc:29)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.EnvUDF.call(EnvUDF.java:119)
at lucee.runtime.ComponentScopeShadow.call(ComponentScopeShadow.java:313)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1777)
at system.async.tasks.scheduledtask_cfc$cf.udfCall3(/coldbox/system/async/tasks/ScheduledTask.cfc:702)
at system.async.tasks.scheduledtask_cfc$cf.udfCall(/coldbox/system/async/tasks/ScheduledTask.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:702)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2012)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:900)
at lucee.runtime.functions.dynamicEvaluation.Invoke.call(Invoke.java:54)
at lucee.runtime.functions.dynamicEvaluation.Invoke.call(Invoke.java:37)
at system.async.cbproxies.models.runnable_cfc$cf.udfCall(/coldbox/system/async/cbproxies/models/Runnable.cfc:37)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988)
at lucee.runtime.java.JavaProxy.call(JavaProxy.java:63)
at lucee.runtime.op.JavaProxyUtilImpl.call(JavaProxyUtilImpl.java:13)
at Vd959d9902a4c8010160b36b49eb886923699.run(Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
lucee.runtime.exp.NativeException: Cannot extend unmapped class cbContent
at org.hibernate.cfg.HbmBinder.getSuperclass(HbmBinder.java:2737)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:176)
at org.hibernate.cfg.Configuration.add(Configuration.java:771)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:542)
at org.lucee.extension.orm.hibernate.HibernateSessionFactory.createConfiguration(HibernateSessionFactory.java:147)
at org.lucee.extension.orm.hibernate.SessionFactoryData.setConfiguration(SessionFactoryData.java:194)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.getSessionFactoryData(HibernateORMEngine.java:191)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.reload(HibernateORMEngine.java:98)
at lucee.runtime.config.ConfigImpl.resetORMEngine(ConfigImpl.java:3049)
at lucee.runtime.config.ConfigWebImpl.resetORMEngine(ConfigWebImpl.java:654)
at lucee.runtime.orm.ORMUtil.resetEngine(ORMUtil.java:74)
at lucee.runtime.functions.orm.ORMReload.call(ORMReload.java:40)
at application_cfc$cf.udfCall(/Application.cfc:174)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:446)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:137)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2494)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2480)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2451)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1219)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1165)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at mod_cfml.core.invoke(core.java:180)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:422)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.MappingException: Cannot extend unmapped class cbContent
… 54 more
lucee.runtime.exp.NativeException: Cannot extend unmapped class cbContent
at org.hibernate.cfg.HbmBinder.getSuperclass(HbmBinder.java:2737)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:176)
at org.hibernate.cfg.Configuration.add(Configuration.java:771)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:542)
at org.lucee.extension.orm.hibernate.HibernateSessionFactory.createConfiguration(HibernateSessionFactory.java:147)
at org.lucee.extension.orm.hibernate.SessionFactoryData.setConfiguration(SessionFactoryData.java:194)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.getSessionFactoryData(HibernateORMEngine.java:191)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.reload(HibernateORMEngine.java:98)
at lucee.runtime.config.ConfigImpl.resetORMEngine(ConfigImpl.java:3049)
at lucee.runtime.config.ConfigWebImpl.resetORMEngine(ConfigWebImpl.java:654)
at lucee.runtime.orm.ORMUtil.resetEngine(ORMUtil.java:74)
at lucee.runtime.functions.orm.ORMReload.call(ORMReload.java:40)
at application_cfc$cf.udfCall(/Application.cfc:174)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:356)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:701)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:589)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1993)
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:446)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:137)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2494)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2480)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2451)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1219)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1165)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at mod_cfml.core.invoke(core.java:180)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:422)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractPro

In contentbox there is a chain of extensions already for these CFCs

My new Media.cfc

component
persistent =“true”
entityname =“cbMedia”
table =“cb_media”
batchsize =“25”
cachename =“cbMedia”
cacheuse =“read-write”
extends =“modules.contentbox.models.content.BaseContent”
joinColumn =“contentID”
discriminatorValue=“Media”
{… }

I was almost copying the existing code in the contentbox system…

Eg: Entry.cfc

component
persistent =“true”
entityname =“cbEntry”
table =“cb_entry”
batchsize =“25”
cachename =“cbEntry”
cacheuse =“read-write”
extends =“BaseContent”
joinColumn =“contentID”
discriminatorValue=“Entry”
{… }

BaseContent:

component
persistent =“true”
entityname =“cbContent”
table =“cb_content”
extends =“contentbox.models.BaseEntityMethods”
cachename =“cbContent”
cacheuse =“read-write”
discriminatorColumn=“contentType”
{… }

BaseEntityMethods:
component {… }

Actually it looks like this should be mapped and it isn’t. There is another

I am confused because there is another cfc called BaseEntity which has:

component
mappedsuperclass=“true”
accessors =“true”
extends =“BaseEntityMethods”
{… }

What I can’t understand is how the Entry.cfc could work and Media.cfc produces the error. Perhaps it is something to do with the order of execution?

I was able to fix this error with the help of jclausen of Ortus.

It seems that while Lucee could locate the CFC I am extending with
extends =“modules.contentbox.models.content.BaseContent”
wire box could not and changing that line to
extends =“contentbox.models.content.BaseContent”
means that both could find it. Problem solved.

1 Like

Hi Kevin,
FIrstly, glad you got it fixed…
That @Jon_Clausen is a helpful resource for us all!

Is there any value in suggesting that you don’t use an ORM?
(I note you said you’re just starting out with it)

We use it our application and I have ALWAYS found the promised benefits of using an ORM to heavily outweight the actual results.
Kind of l;ike communism… great in theory - doesn’t work in the real world.

  • Without a fantastic amount fo work, reporting is impossible via ORM
  • ormExecuteQuery (especially if new to it) takes a steep and long learning curve to get your brain to think in the way of objects for writing queries.
  • (for us) there is a tremendous amount of customisation (method overriding) required - as opposed to “just” being able to use the automatically generated getters/setters.
  • It is (simply, just a fact) - it is slower than plain-sql.
1 Like

It also encourages writing pretty bad “inside out” code where the calling code ends up with the modelling logic in it, instead of the entity itself.

Reading:

Unless you specifically need DB-platform-neutrality in your app… ie you have a CURRENT requirement for it to run on different DB systems. I’d swerve that path.

If you implement a “service” → “gateway / DAO” architecture then you can add in platform specific queries where / when needed.

We use ColdSpring and utilise AOP and onMissingMethod() to cut down on the boiler-plate code.

  • userService - is the public API
  • userGateway - is the implementation of the actual SQL

The *Service and the *Gateway methods are (nearly always) identical
The Service method calls the gateway method of the same name with the same parameter types / names / etc…

//Psuedo-code of course!

//UserService.cfc
function saveUser (param1Type paramName1, ...) {
    return UserGateway.saveUser(arguments.paramName1...);
}

//UserGateway.cfc
function saveUser(param1Type paramName1...) {
    transaction action="begin" {
        try {
            var theQry = new Query(sql = "xxxxx").execute().getResult();        
            transactionCommit();
        } catch (any theCaughtError) {

            // do stuff : 
            // logging maybe / send an email / try again perhaps?
            transactionRollback();
        } // End try/catch
    } // End transaction
}

But you can avoid writing the *Service methods, entirely (there is no method called saveUser() in the UserService CFC) by utilising onMissingMethod() to call the matching function in the *Gateway version.

Where for any SQL that needs a (DB platform specific difference) - you would test for that by configuration and dynamically produce the SQL based on DB platform specific rules / pattern matching - if you can - it might look like;

//UserGateway.cfc
component {
    function saveUser(param1Type paramName1...) {
       switch(application.configuration.dbType) {
            case "postgres" :
                return saveUser_postgres(xxxx);
            case "oracle" :
                return saveUser_oracle(xxxx);
            default :
                return saveUser(xxxx);
        } //End DB Type switch
    }

    function saveUser_postgres(param1Type param1Name...) {
        //do postgresql specific query
    }

    function saveUser_oracle(param1Type param1Name...) {
        //do oracle specific query
    }

    function saveUser(param1Type param1Name...) {
        //generic SQL 
    }
} // End component

“I” think it is easier to reason about.
and since I spend most of my time trying to understand the portion of code that I am maintaining / adding new features to - as opposed to actually doing the typing of code - something that makes it easier “to get”, right from the beginning - is a big “plus” for me.

You get “control” of everything in your code,
You’re only tightly coupled to the JBC driver - not a 3rd party library (and not their schedule for doing updates / security patches / etc).
And in the Lucee world this is exasserbated by the additioanl reliance upon an extension provider for the ORM library.

Anyway…
Just an opinion…

Adam and Gavin, Thank you both for your responses.

I am fairly committed to using ContentBox for this project, and ORM is embedded in the existing code.

When ORM was first incorporated in ACF I took a look at it and decided that cfquery and SQL was easier and my recent experience has not changed that. Having taught SQL for the Open University I am more comfortable using SQL than anything else. Having retired now I offered to build new website for our community centre and decided to learn about ContentBox by building a new website for myself first with this project.

The project is to build a website for my personal photography hobby. ContentBox might be overkill for that but I also want to learn to use it for our community centre and the list of their requirements means that WordPress would not be suitable and ContentBox will do a lot more of what is needed. My CF experience meant that I could build the missing bits without learning a completely new language. Though ORM is turning out more like a new language than I expected.

Thanks again for your help. Hopefully, we can meet again at some future event and I can buy you a drink.

Kevin

Just sorry we couldn’t actually address yer issue. I only had that one idea, and it’s not applicable to your situation as we found out with your follow-up.