1 Reply Latest reply on May 12, 2003 2:59 AM by Dietmar Scheidl

    EJB-QL 'Like' Query

    klogg Newbie


      I am trying create a finder method in my EJB that will find all entities whose names start with a particular letter, but alas the query I have doesn't return anything (I am running JBoss with MySQL).

      My query is:

      select object(a)
      from Artist a
      where a.name like '?1%'

      Any help would be appreciated!


        • 1. Re: EJB-QL 'Like' Query
          Dietmar Scheidl Newbie


          EJB-QL does not support LIKE ?1 instead you have to use JBossQL.

          Therefore you have to put the definition of the finder into your jbosscmp-jdbc.xml file.



          SELECT OBJECT(u)
          FROM YourBean u
          WHERE u.yourField LIKE ?1