0 Replies Latest reply on Dec 2, 2003 1:00 AM by xunzhang

    Jbossql in find method

    xunzhang Newbie

      My jbosscmp-jdbc.xml is :
      <?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:/OracleDS
      <datasource-mapping>Hypersonic SQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>true</remove-table>
      <pk-constraint>true</pk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


      <enterprise-beans>


      <ejb-name>Account</ejb-name>
      <table-name>account</table-name>

      <cmp-field>
      <field-name>accountNo</field-name>
      <column-name>ACCOUNT_NO</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>balance</field-name>
      <column-name>BALANCE</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>accountType</field-name>
      <column-name>ACCOUNT_TYPE</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>limit</field-name>
      <column-name>LIMIT</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>accountProfileId</field-name>
      <column-name>ACCOUNT_PROFILE_ID</column-name>
      </cmp-field>

      <query-method>
      <method-name>findByAccountProfileId</method-name>
      <method-params>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <jboss-ql><![CDATA[
      SELECT OBJECT(a)
      FROM account a
      WHERE a.accountProfileId = ?1
      ]]></jboss-ql>





      </enterprise-beans>
      </jbosscmp-jdbc>


      I encountered the following exception when deploying my entity bean: ( Any idea what is wrong with the JBossQL statement? Thanks in advance.)

      org.jboss.deployment.DeploymentException: Error compiling JBossQL statement 'SEL
      ECT OBJECT(a)
      FROM account a
      WHERE a.accountProfileId = ?1'; - nested throwable: (org.jboss.ej
      b.plugins.cmp.ejbql.ParseException: Encountered "account" at line 2, column 21.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.(JDBCJBossQLQue
      ry.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createJBossQLQuery(
      JDBCCommandFactory.java:63)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManage
      r.java:200)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDB
      CStoreManager.java:451)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:351)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
      er.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:343)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
      92)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy74.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
      92)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      ...