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

Date Diff and Compare member functions don't work with dates loaded via ORM

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.5.1.000
    • Fix Version/s: 5.1.1.15
    • Labels:
      None
    • Environment:

      Java 1.8u45, Tomcat 7, Windows 8.1

      Description

      DateCompare() and DateDiff() have been implemented as member functions meaning they can be used as follows:

      date1=Now();
      date2=Now();
      Dump( date1.Compare( date2,"d" ) );//outputs 0
      

      This will also work with date values in a query recordset.

      However, if the date values are properties of an ORM entity, the following error is thrown:

      No matching Method/Function for java.sql.Timestamp.Compare(datetime, string) found

      Changing the property's ormType to date, makes no difference.

      Stacktrace:

      No matching Method/Function for java.sql.Timestamp.Compare(datetime, string) found
       	at lucee.runtime.reflection.Reflector.throwCall(Unknown Source):-1
       	at lucee.runtime.reflection.Reflector.callMethod(Unknown Source):-1
       	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(Unknown Source):-1
       	at lucee.runtime.PageContextImpl.getFunction(Unknown Source):-1
       	at orm.datecompare.index_cfm$cf.call(C:\test\index.cfm:10):10
       	at lucee.runtime.PageContextImpl.doInclude(Unknown Source):-1
       	at lucee.runtime.PageContextImpl.doInclude(Unknown Source):-1
       	at lucee.runtime.listener.ModernAppListener._onRequest(Unknown Source):-1
       	at lucee.runtime.listener.MixedAppListener.onRequest(Unknown Source):-1
       	at lucee.runtime.PageContextImpl.execute(Unknown Source):-1
       	at lucee.runtime.PageContextImpl.execute(Unknown Source):-1
       	at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(Unknown Source):-1
       	at lucee.loader.servlet.CFMLServlet.service(Unknown Source):-1
       	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727):727
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303):303
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208):208
       	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241):241
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208):208
       	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220):220
       	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122):122
       	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501):501
       	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171
       	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102):102
       	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116):116
       	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408):408
       	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193):193
       	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607):607
       	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314):314
       	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
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                michaeloffner Michael Offner
                Reporter:
                julianhalliwell Julian Halliwell
              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: