Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    server side AdvancedCriteria with DateRangeCriterion: bug or not supported?

    SmartClient 2012-02-08_v8.2p/PowerEdition
    I tried to create an advanced criteria like this:
    Code:
    Criterion dateRangeCriterion = new DateRangeCriterion("DATA_CONSEGNA", "lessOrEqual", dataMin, dataMax);
    AdvancedCriteria criteria = new AdvancedCriteria(DefaultOperators.And, new Criterion[]{
      new SetCriterion("STATO_RICHIESTA", "inSet", statiRichiesta),
      dateRangeCriterion
    });
    but on the setAdvancedCriteria:
    Code:
    dsRequestRichieste.setAdvancedCriteria(criteria);
    I got this exception
    Code:
    === 2012-02-20 15:06:48,656 [-143] DEBUG DataSourceDMI - Invocation threw exception
    java.lang.ClassCastException: com.isomorphic.criteria.criterion.DateRangeCriterion
    	at com.isomorphic.criteria.SimpleOperator.convertToMap(SimpleOperator.java:61)
    	at com.isomorphic.criteria.LogicalOperator.convertToMap(LogicalOperator.java:64)
    	at com.isomorphic.criteria.AdvancedCriteria.getCriteriaAsMap(AdvancedCriteria.java:181)
    	at com.isomorphic.datasource.DSRequest.setAdvancedCriteria(DSRequest.java:840)
    	at com.juve.eleven.eventi.FetchCalendarioDMI.aggiungiRichieste(FetchCalendarioDMI.java:100)
    	at com.juve.eleven.eventi.FetchCalendarioDMI.fetch(FetchCalendarioDMI.java:66)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:950)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:386)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1945)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:178)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:92)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:189)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:189)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:110)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:110)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:170)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:238)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:168)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at com.isomorphic.js.JSSyntaxScannerFilter.doFilter(JSSyntaxScannerFilter.java:241)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:77)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:120)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
    	at java.lang.Thread.run(Thread.java:662)
    === 2012-02-20 15:06:48,656 [-143] WARN  RequestContext - dsRequest.execute() failed: 
    java.lang.ClassCastException: com.isomorphic.criteria.criterion.DateRangeCriterion
    	at com.isomorphic.criteria.SimpleOperator.convertToMap(SimpleOperator.java:61)
    	at com.isomorphic.criteria.LogicalOperator.convertToMap(LogicalOperator.java:64)
    	at com.isomorphic.criteria.AdvancedCriteria.getCriteriaAsMap(AdvancedCriteria.java:181)
    	at com.isomorphic.datasource.DSRequest.setAdvancedCriteria(DSRequest.java:840)
    	at com.juve.eleven.eventi.FetchCalendarioDMI.aggiungiRichieste(FetchCalendarioDMI.java:100)
    	at com.juve.eleven.eventi.FetchCalendarioDMI.fetch(FetchCalendarioDMI.java:66)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:950)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:386)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1945)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:178)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:92)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:189)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:189)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:110)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:110)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:170)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:238)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:168)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at com.isomorphic.js.JSSyntaxScannerFilter.doFilter(JSSyntaxScannerFilter.java:241)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:77)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:120)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
    	at java.lang.Thread.run(Thread.java:662)
    so I created the criteria like this:
    Code:
    AdvancedCriteria dateRangeCriterion = new AdvancedCriteria(DefaultOperators.And, new Criterion[]{
      new SimpleCriterion("DATA_CONSEGNA", "lessOrEqual", dataMax),
      new SimpleCriterion("DATA_CONSEGNA", "greaterOrEqual", dataMin)
    );
    AdvancedCriteria criteria = new AdvancedCriteria(DefaultOperators.And, new Criterion[]{
      new SetCriterion("STATO_RICHIESTA", "inSet", statiRichiesta),
      dateRangeCriterion.asCriterion()
    });
    and it works.
    But why didn't it work using a DateRangeCriterion?
    Last edited by claudiobosticco; 21 Mar 2012, 05:37. Reason: fixed

    #2
    Thanks for the report, this has been fixed and the fix will be in the next 3.0p and 3.1d builds.

    Comment


      #3
      Originally posted by Isomorphic
      Thanks for the report, this has been fixed and the fix will be in the next 3.0p and 3.1d builds.
      I'm trying SC_SNAPSHOT-2012-03-05_v8.2p/PowerEdition, the setAdvancedCriteria methon doesn't throws exception, but the DateRangeCriterion doesn't appear in the generated SQL.

      Comment


        #4
        It's likely that your only (remaining) problem here is the use of operator "lessOrEqual" - this is a single comparison operator, not a range operator. Our local tests with the most recent code show that DateRangeCriterion is working fine if we use the "between" operator, so please try that. If you still have problems, please try it with most recent 8.3d nightly.

        Comment


          #5
          still not working with 2012-03-14_v8.2p (tried "between" and "betweenInclusive")

          if it's a 8.3d feature, I'd prefer staying with 8.2p for now, I can live with the extra code to create a "dateRangeCriterion"

          thanks for your support!

          Comment


            #6
            The fix has been ported to 8.2p, but that happened later yesterday, after the build had been cut. Today's 8.2p build should include it.

            Comment


              #7
              just tried with 2012-03-20_v8.2p, and it's working.

              thank you very much!

              Comment

              Working...
              X