1 Reply Latest reply on Aug 27, 2002 1:32 PM by dsundstrom

    query method in CMP2.0

    hyao

      Hi, all.

      I am using Jboss3.0.0+Jetty, and I met a problem when I wrote deploy descriptor for query methods. Here is a example of mine in ejb-jar.xml, but I can not deploy to jboss successfully. It kept saying " a.urlid was expecting one of ... or ... or or...". Looks like after a.urlid it was expecting some operation. It's wild. Could anybody tell me what's wrong? What's relationship among ejb-jar.xml, jboss.xml and jbosscmp-jdbc.xml?

      in ejb-jar.xml:
      ...

      <query-method>
      <method-name>findByUrlidAndConceptid</method-name>
      <method-params>
      <method-param>java.math.BigDecimal</method-param>
      <method-param>java.math.BigDecimal</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(b) FROM UrlConcept AS b WHERE b.urlid = ?1 AND b.conceptid = ?2]]>
      </ejb-ql>


      <query-method>
      <method-name>findByConceptid</method-name>
      <method-params>
      <method-param>java.math.BigDecimal</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM UrlConcept AS a WHERE a.conceptid = ?1]]>
      </ejb-ql>

      ...

      and the error message is:

      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwa
      ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "a.urlid" at l
      ine 2, column 85.
      Was expecting one of:
      "ABS" ...
      "LENGTH" ...
      "LOCATE" ...
      "SQRT" ...
      "(" ...
      "+" ...
      "-" ...
      <INTEGER_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <NUMERIC_VALUED_PARAMETER> ...
      <NUMERIC_VALUED_PATH> ...
      "NOT" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.j
      ava:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JD
      BCCommandFactory.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManage
      r.java:214)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:389)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
      er.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:793)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:894)

      Thanks,
      hongmei

        • 1. Re: query method in CMP2.0
          dsundstrom

          What is the query that is breaking? It will be the one containing 'a.urlid'. If you can't determin the query, turn the log level for category org.jboss.ejb.plugins.cmp up to DEBUG in the log4j.xml file.

          This looks like you are trying to compare a number to a string which is not allowed by EJB-QL.