2 Replies Latest reply on Jan 25, 2004 6:09 AM by juha

    VERY URJENT!! Seems like JBOSS replaces String params with n

    bentins

       

      "bentins" wrote:
      "bentins" wrote:
      I have the following doclet:

      * @ejb.finder
      * query = "SELECT DISTINCT OBJECT(a) FROM User AS a WHERE a.userName LIKE '%?1%'"
      * signature = "com.matrix.framework.ip.UserLocal findByUserName(java.lang.String aUserName)"

      it compiles and deploys with no problem!!!

      When I call the finder it finds nothing! eventhough such a user exists!!!
      more over when I tested the doclet by putting the string directly into it like this:

      * @ejb.finder
      * query = "SELECT DISTINCT OBJECT(a) FROM User AS a WHERE a.userName LIKE '%james%'"
      * signature = "com.matrix.framework.ip.UserLocal findByUserName(java.lang.String aUserName)"

      it found the object.

      I used p6Spy driver to look at the SQL. Here is what was generated:

      1074621247243|5|0|statement|SELECT DISTINCT t0_a.ID FROM EMI_USER t0_a WHERE (t0_a.USER_NAME LIKE '%?1%')|SELECT DISTINCT t0_a.ID FROM EMI_USER t0_a WHERE (t0_a.USER_NAME LIKE '%null1%')

      it seems that Jboss replaced my String with nulls. I checked my code and printed out the strings just before the finder is run and it had a good value.

      Can anyone help me on what could be wrong here?


        • 1. Re: VERY URJENT!! Seems like JBOSS replaces String params wi
          bentins

           

          "bentins" wrote:
          OK, for this question one should reply:

          READ THE SPEC!!!!!!!!!!

          'LIKE' does not accept parameters.

          heres what works:

          * @ejb.finder
          * query = "SELECT DISTINCT OBJECT(a) FROM User AS a WHERE a.userName=?1"
          * signature = "com.matrix.framework.ip.UserLocal findByUserName(java.lang.String aUserName)"

          turns out that it is also important to have the '=' directly after the field name with no space???? an Xdoclet issue? Jboss issue?

          anyother interesting comments will be appreciated.


          • 2. Re: VERY URJENT!! Seems like JBOSS replaces String params wi

            JBossQL supports LIKE clauses with parameters. You are correct in noting that it is not supported with EJB-QL.