1 Reply Latest reply on Feb 19, 2003 7:06 PM by Frank Langelage

    WHERE ... LIKE ?1 does not work

    Th. A. Elmiger Newbie

      I have written a CMP bean for addresses. All works well except one finder method which should accept a partial match (LIKE with %). I am working for hours now but nothing works.
      With regular EJB-QL the container flags LIKE as a syntax error.
      * @ejb:finder signature="java.util.Collection findByShortName(java.lang.String shortName)"
      * query="SELECT OBJECT(g) FROM Address g WHERE g.shortName LIKE ?1"
      With JBOSS-QL the container accepts it but treats LIKE as if it were a "=".
      I am pretty confused. Am I just too tired to see the mistake or is there something I didn't get right?

        • 1. Re: WHERE ... LIKE ?1 does not work
          Frank Langelage Master

          I used this XDoclet tags on my AddressBean an it works perfect:
          * @ejb.finder signature="java.util.Collection findByMatchcode( java.lang.String matchcode )"
          * view-type="local"
          * query="SELECT OBJECT(o) FROM Address AS o WHERE o.matchcode LIKE '%SIEMENS%'"
          * result-type-mapping="Local"
          * @jboss.query signature="java.util.Collection findByMatchcode( java.lang.String matchcode )"
          * query="SELECT OBJECT(o) FROM Address AS o WHERE o.matchcode LIKE ?1 ORDER BY o.id"