1 Reply Latest reply on Dec 7, 2001 12:57 PM by randyshoup

    EJBQL ignoring WHERE clause?

    randyshoup

      I am trying to use EJBQL on JBoss3.0 alpha. As far as I can tell from the behavior I can see in my application and from the logs, the WHERE clause of my EJBQL is being ignored. I have tried modifying the WHERE clause in several ways, and cannot seem to get it to be converted into SQL. Is this a bug or am I doing something wrong?

      ejb-jar.xml:
      ...

      <query-method>
      <method-name>findLessThanId</method-name>
      <method-params>
      <method-param>long</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(obj) FROM CustomObjectEJB AS obj WHERE name like '%Modified%']]>
      </ejb-ql>

      ...

      server.log:
      ...
      [2001-12-06 18:35:14,822,CMP,DEBUG] EQL-QL:
      SELECT OBJECT(obj) FROM CustomObjectEJB AS obj WHERE name like '%Modified%'

      [2001-12-06 18:35:14,947,CMP,DEBUG] Assembly: []SELECT/OBJECT/(/obj/)/FROM/CustomObjectEJB/AS/obj^WHERE/name/like/'%Modified%'
      [2001-12-06 18:35:14,947,CMP,DEBUG] findLessThanId SQL: SELECT t1_obj.TwId FROM TwCustomObject t1_obj
      ...

      Notice that the generated SQL here has no WHERE clause. There seems to be a '^' character before the WHERE which might indicate a problem?

      Thanks,
      -- Randy

        • 1. [SOLVED] Re: EJBQL ignoring WHERE clause?
          randyshoup

          Sorry to reply to my own post, but I realized my mistake overnight: I had not properly qualified the field name in the WHERE clause. When I use 'obj.name' instead of 'name' in the WHERE, it works as expected.

          It would be cool to get some kind of error here, but hey, it's only alpha.

          -- Randy