1 Reply Latest reply on Mar 21, 2003 2:01 PM by Vesselen Nedkov

    ParseException in EJBQL

    Dan Osterrath Newbie

      Hi,

      I've written an entity bean with some finder methods. Unfortunately JBoss doesn't like that. :-(
      Here's the (shortened) code:


      /**
      * @ejb.bean
      * name="EntitySearch"
      * description="EJB EntitySearch"
      * type="CMP"
      * view-type="both"
      * @ejb.finder
      * description="search for a Search by employment_days"
      * signature="java.util.Collection findByEmploymentDays(java.util.Set pEmploymentDays)"
      * query="SELECT Object(so) FROM EntitySearch AS so WHERE so.employmentDays=?1"
      *
      *
      * @ejb.persistence
      * table-name="gp_search"
      *
      * @ejb.transaction
      * type="Required"
      *
      * @ejb.util
      * generate="logical"
      *
      * @ejb.data-object
      * equals="true"
      * extends="com.dev3m5.gp.ejb.AbstractData"
      *
      * @ejb.facade
      * name="SecuredSearch"
      * view-type="remote"
      * type="CMP"
      */

      public abstract class EntitySearchBean extends BaseEntityBean implements EntityBean
      {
      public EntityContext mContext;

      /**
      * @ejb.persistence
      * column-name="employment_days"
      */
      public abstract java.util.Set getEmploymentDays();
      public abstract void setEmploymentDays( java.util.Set pEmploymentDays );
      }


      JBoss then gives the following error when deploying:


      2003-03-12 18:38:54,387 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=EntityGroup,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "so.employmentDays" at line 1, column 52.
      Was expecting one of:
      "NOT" ...
      "(" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      <NUMERIC_VALUED_PATH> ...
      "LENGTH" ...
      "LOCATE" ...
      "ABS" ...
      "SQRT" ...
      "+" ...
      "-" ...
      <INTEGER_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <NUMERIC_VALUED_PARAMETER> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:218)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:463)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:369)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:1003)
      at $Proxy4.start(Unknown Source)

        • 1. Re: ParseException in EJBQL
          Vesselen Nedkov Newbie

          I am facing a similar issue with Jboss 3.2 RC2. The query

          SELECT OBJECT(o) FROM User o, IN(o.classes) c WHERE c.classIdField = ?1

          fails with a similar compiler exception...

          Depends On Me: org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "classIdField" at line 1, column 119.
          Was expecting one of:
          "NOT" ...
          "(" ...
          <COLLECTION_VALUED_PATH> ...
          <NUMERIC_VALUED_PATH> ...
          <STRING_VALUED_PATH> ...
          <DATETIME_VALUED_PATH> ...
          <BOOLEAN_VALUED_PATH> ...
          <ENTITY_VALUED_PATH> ...
          <VALUE_CLASS_VALUED_PATH> ...
          "CONCAT" ...

          Does anyone have any ideas? solutions?