Uploaded image for project: 'Lucee Development'
  1. LDEV-490

Regression - "ORM not enabled" error when ORM attributes are used

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.5.1.022, 4.5.2.010
    • Fix Version/s: 4.5.3.002, 5.0.0.216
    • Labels:
      None

      Description

      If you use attribute names on a component or property that are used in ORM, but you are not actually using ORM it will now error with "ORM not enabled". This is new behavior (not sure which Lucee update changed it) and is incompatible with ACF.

      For example, say you have a component like this:

      // filename: model.cfc
      component persistent="true" accessors="true"{
         property name="ID"';
      }
      

      Then call that from a cfm template:

      <cfscript>
         a = new model();
         a.setID( 2 );
      </cfscript>
      

      It will throw the error on line 3 ( a.setID( 2 ) ):

      ORM is not enabled
       	at lucee.runtime.op.ExceptonImpl.createApplicationException(ExceptonImpl.java:88):88
       	at lucee.runtime.orm.hibernate.ExceptionUtil.createException(ExceptionUtil.java:61):61
       	at lucee.runtime.orm.hibernate.HibernateORMEngine.getSessionFactoryData(HibernateORMEngine.java:126):126
       	at lucee.runtime.orm.hibernate.HibernateORMEngine.init(HibernateORMEngine.java:88):88
       	at lucee.runtime.config.ConfigImpl.getORMEngine(ConfigImpl.java:2922):2922
       	at lucee.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3135):3135
       	at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:59):59
       	at lucee.runtime.orm.ORMUtil.getSession(ORMUtil.java:55):55
       	at lucee.runtime.type.UDFSetterProperty.call(UDFSetterProperty.java:91):91
       	at lucee.runtime.type.UDFGSProperty.call(UDFGSProperty.java:282):282
       	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:641):641
       	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
       	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1760):1760
       	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:742):742
       	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1589):1589
       	at test_cfm$cf.call(/home/webs/ormbug/test.cfm:3):3
       	at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:950):950
       	at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:56):56
       	at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:36):36
       	at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2257):2257
       	at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2224):2224
       	at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456
       	at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:47):47
       	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729):729
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291):291
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206
       	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239):239
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206
       	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219):219
       	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106):106
       	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502):502
       	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142):142
       	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79):79
       	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88):88
       	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518):518
       	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091):1091
       	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668):668
       	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527):1527
       	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484):1484
       	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142):1142
       	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617):617
       	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61):61
       	at java.lang.Thread.run(Thread.java:745):745
      

      This prevents libraries that may leverage these attributes from working. Perhaps if this behavior is desired there can be a setting somewhere to disable?

      Note that this is not specific to the persistent="true" attribute, but also attributes like fieldType, cfc, fkcolumn, etc....

      I use a lib that provides ORM like behaviors for model components without actually using ORM. The api was developed to mimic the ACF ORM attributes so that they are consistent (i.e. defining relationship/mappings). With this change in Lucee I can no longer support the Lucee cfml engine without namespacing the attributes - causing clutter and confusion and breaking backwards compatibility.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                michaeloffner Michael Offner
                Reporter:
                aadams Abram Adams
              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: