2 Replies Latest reply on Aug 3, 2004 6:26 AM by Roberto Colmegna

    LIKE problem with CMP and declared-sql

    Roberto Colmegna Newbie

      JBOSS: 3.2.4
      PostgresDB: 7.4.2

      EJB XDocLet declaration:
      * @ejb.finder signature="java.util.Collection findByInfo(java.lang.String info)"
      * query=""
      * @jboss.declared-sql signature="java.util.Collection findByInfo(java.lang.String info)"
      * where="idA LIKE '%{0}%'"
      * strategy="on-find"

      jbosscmp-jdbc.xml
      ...
      <query-method>
      <method-name>findByInfo</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>

      Calling code:
      BBeanUtil.getLocalHome().findByInfo("123");

      Problem:
      DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCDeclaredSQLQuery.BBean#findByInfo] Executing SQL: SELECT id, idA, info FROM b WHERE info LIKE '%?%'
      2004-08-03 10:36:11,197 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCDeclaredSQLQuery.BBean#findByInfo] Find failed
      org.postgresql.util.PSQLException: Parameter index out of range.
      at org.postgresql.jdbc1.AbstractJdbc1Statement.bind(AbstractJdbc1Statement.java:2082)


      Why I can't do a LIKE call (Postgres/JDBC-PG
      admit this...)?

      TIA
      Roberto Colmegna