2 Replies Latest reply on Jul 9, 2003 1:12 AM by Jeovanny

    org.jboss.ejb.plugins.cmp.ejbql.ParseException

    Jeovanny Newbie

      I can't get a simple CMP example to work. I have purchased the CMP Docs and even the doc example doesn't work.

      My simple CMP example is creating a Users table in my Microsoft SQL Server 2000 database, but then fails on trying to compile the EJB-QL. I have overriden the EJB-QL in the ejb-jar with jboss-ql. I have been working on this for days and can't get around it. I am about ready to go back to BMP's, however, I would hate to not use CMP's because it doesn't work.

      I get the following stack trace in the JBoss logs when trying to deploy my jar, yet the Users table does exist and has only those two fields in it.

      ------------------------------------------
      11:01:24,196 INFO [EjbModule] Creating
      11:01:24,226 INFO [EjbModule] Deploying UserBean
      11:01:24,316 INFO [EntityContainer] Creating
      11:01:24,326 INFO [EntityInstancePool] Creating
      11:01:24,326 INFO [EntityInstancePool] Created
      11:01:24,346 INFO [EntityContainer] Created
      11:01:24,346 INFO [EjbModule] Created
      11:01:24,356 INFO [EjbModule] Starting
      11:01:24,366 INFO [EntityContainer] Starting
      11:01:25,277 INFO [UserBean] Table 'Users' already exists
      11:01:25,287 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Error compiling JBossQL statement 'SEL
      ECT DISTINCT OBJECT(o) FROM Users o WHERE o.GivenName = '?1''; - nested throwabl
      e: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Users" at line
      1, column 32.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.(JDBCJBossQLQue
      ry.java:46)

      ------------------------------------------------------
      jbosscmp-jdbc.xml
      ------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">

      <jbosscmp-jdbc>

      java:/MSSQLDS_TimeTracker
      <datasource-mapping>MS SQLSERVER2000</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>true</remove-table>


      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
      that contains the markup for those beans.
      -->


      <ejb-name>UserBean</ejb-name>
      <table-name>Users</table-name>

      <cmp-field>
      <field-name>recordId</field-name>
      <column-name>RecordId</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>givenName</field-name>
      <column-name>GivenName</column-name>

      </cmp-field>


      <query-method>
      <method-name>findByGivenName</method-name>
      <method-params>
      <method-param>
      java.lang.String
      </method-param>
      </method-params>
      </query-method>
      <jboss-ql>
      SELECT DISTINCT OBJECT(o) FROM Users o WHERE o.GivenName = '?1'
      </jboss-ql>




      </enterprise-beans>

      </jbosscmp-jdbc>