2 Replies Latest reply on Sep 10, 2002 8:29 AM by cpairot

    Error compiling ejbql

    cpairot

      Hi all,

      I am just having a problem defining an entity's finder query. The query is defined as follows:


      <query-method>
      <method-name>findByUserAndRole</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[SELECT OBJECT(r) FROM ProjectUserRole AS r WHERE r.user = ?1 AND r.role = ?2]]></ejb-ql>


      But when I deploy it on JBoss 3.0.2 it gives me this error:

      09:31:20,328 WARN [ServiceController] Problem starting service jboss.j2ee:servi
      ce=EJB,jndiName=ejb/botule/Role
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwa
      ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1,
      column 59.
      Was expecting one of:
      <IDENTIFICATION_VARIABLE> ...
      <ENTITY_VALUED_PARAMETER> ...
      <ENTITY_VALUED_PATH> ...
      )
      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.startStoreManager(JDB
      CStoreManager.java:463)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:369)
      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:764)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      ...

      As the query's syntax appears to be fine, I think the problem may be because the ?1 and ?2 parameters are in fact VARCHAR(48) fields rather than VARCHAR(255) fields, as Java Strings are mapped to. So I think I have an incompatible type problem.

      If so, do you have any ideas on how could I fix this problem ?

      Thanks in advance.

      --

      Carles.