2 Replies Latest reply on Jul 17, 2002 11:45 AM by Dain Sundstrom

    using an entity as a finder method param

    Josh Lisle Newbie

      i'm using cmp 2.0 on jboss 3.0.0 and tomcat 4.0.3.

      i'm trying to use a custom finder method with declared-sql. i have finders that use simple parameters or none at all and they work find. however, i'm trying to use a entity as a parameter and i get the following message:

      2002-07-16 13:39:42,148 ERROR [org.jboss.ejb.EJBDeployer] Could not deploy file:/C:/jboss-3.0.0_tomcat-4.0.3/server/default/deploy/gw.jar
      java.lang.IllegalArgumentException: Could not find a field for the cmp-jdbc data for entity with the interface com.profitool.domain.utility.ReportLocal
      at org.jboss.ejb.plugins.cmp.jdbc.QueryParameter.getCMPField(QueryParameter.java:322)
      at org.jboss.ejb.plugins.cmp.jdbc.QueryParameter.(QueryParameter.java:189)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.parseParameters(JDBCAbstractQueryCommand.java:251)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCDeclaredSQLQuery.(JDBCDeclaredSQLQuery.java:61)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createDeclaredSQLQuery(JDBCCommandFactory.java:39)


      the "ReportParam" entity has an Integer primary key of "reportParamId" it is in a many-to-one relationship with "Report" which has an Integer primary key of
      "reportId"

      the finder method in question is declared in jbosscmp-jdbc.xml as:


      <ejb-name>ReportParam</ejb-name>

      <query-method>
      <method-name>findActiveByReport</method-name>
      <method-params>
      <method-param>com.profitool.domain.utility.ReportLocal</method-param>
      </method-params>
      </query-method>
      <declared-sql>
      activeFlag = 0 AND reportId = {0.reportId}
      paramOrder
      </declared-sql>



      i'm not sure how to dereference the primary key, if this is the cause of the error. i didn't have any luck trying to attach files to this message.

      thanks in advance.