Uploaded image for project: 'Railo'
  1. Railo
  2. RAILO-1249

Railo ORM - entityToQuery throws an exception when table has zero records

    Details

    • Steps to Reproduce:
      • Create an empty User table
      • Call this table with rsUser = EntityToQuery(EntityLoad("User",{}));
      • Crash!
    • Workaround Description:
      Hide

      I check if entityLoad returns an empty array, and if so, I just don't call the entityToQuery function. But I then don't have the column names as well.

      Show
      I check if entityLoad returns an empty array, and if so, I just don't call the entityToQuery function. But I then don't have the column names as well.

      Description

      When I use entityToQuery(EntityLoad("User",{})), and the User table
      has zero records, Railo throws the following exception:

      ------------------------------------------
      Exception in onRequestStart
      can not create query

      (application)

      Stacktrace:

      can not create query at
      railo.runtime.orm.hibernate.HibernateCaster.toQuery(HibernateCaster.java:
      406):406 at
      railo.runtime.orm.hibernate.HibernateORMSession.toQuery(HibernateORMSession.java:
      412):412 at
      railo.runtime.functions.orm.EntityToQuery.call(EntityToQuery.java:18):
      18 at
      railo.runtime.functions.orm.EntityToQuery.call(EntityToQuery.java:12):
      12 at application_cfc$cf.udfCall(/home/rainer/www/websites/compName-
      admin/webapp/Application.cfc:97):97 at
      railo.runtime.type.UDFImpl.implementation(UDFImpl.java:227):227 at
      railo.runtime.type.UDFImpl._call(UDFImpl.java:395):395 at
      railo.runtime.type.UDFImpl.call(UDFImpl.java:360):360 at
      railo.runtime.ComponentImpl._call(ComponentImpl.java:573):573 at
      railo.runtime.ComponentImpl._call(ComponentImpl.java:502):502 at
      railo.runtime.ComponentImpl.call(ComponentImpl.java:1755):1755 at
      railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:
      375):375 at
      railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:
      131):131 at
      railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:
      23):23 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:
      1964):1964 at
      railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:
      282):282 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:
      32):32 at javax.servlet.http.HttpServlet.service(HttpServlet.java:722):
      722 at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
      306):306 at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
      210):210 at
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
      240):240 at
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
      161):161 at
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
      164):164 at
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
      100):100 at
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
      118):118 at
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
      383):383 at
      org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:294):294
      at org.apache.coyote.ajp.AjpProtocol
      $AjpConnectionHandler.process(AjpProtocol.java:183):183 at
      org.apache.coyote.ajp.AjpProtocol
      $AjpConnectionHandler.process(AjpProtocol.java:169):169 at
      org.apache.tomcat.util.net.JIoEndpoint
      $SocketProcessor.run(JIoEndpoint.java:288):288 at
      java.util.concurrent.ThreadPoolExecutor
      $Worker.runTask(ThreadPoolExecutor.java:886):886 at
      java.util.concurrent.ThreadPoolExecutor
      $Worker.run(ThreadPoolExecutor.java:908):908 at
      java.lang.Thread.run(Thread.java:662):662
      ------------------------------------------

      Is this expected behaviour, or is this a bug?

      I would suggest, it still returns a query with all colum names, but
      without rows in it.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                micstriit Michael Offner
                Reporter:
                rainerschreiber Rainer Schreiber
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: