2 Replies Latest reply on Nov 10, 2003 10:34 AM by davilch davilch

    finder that checks for zero length parameter does not work?

    davilch davilch Newbie

      Looking for a strategy to handle searches where some of the parameters may be null or empty. I have seen this question before but no answers. I tried the following simple case where I check for a zero length input string...


      <query-method>
      <method-name>findByStatus</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[
      SELECT OBJECT(ab)
      FROM ApplicationBean ab
      WHERE ((LENGTH(?1) = 0) OR (ab.status = ?1))]]>
      </ejb-ql>


      If I call this with a status that is in the db it works fine. If I call it with a zero length status I get no rows back. Anyone have thoughts on why this won't work?

      [I am using jboss 3.2.2 and oracle 9i]