1 Reply Latest reply on Oct 17, 2002 10:35 AM by Jeremy Cowgar

    Using XDocklet

    Jeremy Cowgar Newbie

      Ok, after battling it out with my last problem and finally giving up for the night, I changed what my xdoclet code looks like but now I get a deploy error. Here is my xdoclet code:

      * @ejb:finder signature="java.util.Collection findByName(java.lang.String first, java.lang.String last)"
      * query = "SELECT * FROM patient WHERE fname = ?1 AND lname = ?2"

      That generates (in ejb-jar.xml):


      <query-method>
      <method-name>findByName</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 * FROM patient WHERE fname = ?1 AND lname = ?2]]></ejb-ql>


      The error that is given on the JBoss console is:

      08:33:41,687 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/kp/PatientEn
      tity,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.
      plugins.cmp.ejbql.ParseException: Encountered "patient" at line 1, column 33.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )

      Can anyone tell me what I have done wrong? After the long stack trace (included below) it states:

      08:33:41,718 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompl
      eteDeployments()'

      Here is the full stack trace:

      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.
      plugins.cmp.ejbql.ParseException: Encountered "patient" at line 1, column 33.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.jav
      a:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:218)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:4
      63)
      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:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
      )
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy31.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
      )
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
      )
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy11.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:394)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
      )
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java
      :648)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeplo
      ymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploym
      entScanner.java:225)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeployme
      ntScanner.java:202)

      Thank you,

      Jeremy Cowgar
      rock@cowgar.com

        • 1. Re: Using XDocklet
          Jeremy Cowgar Newbie

          Problem solved. I was treating the SQL as querying the TABLE on the object. Here is what makes it work:

          * @ejb:bean name="PatientEntity"
          * type="CMP"
          * cmp-version="2.x"
          * jndi-name="ejb/kp/PatientEntity"
          *
          * @ejb:ejb-ref ejb-name="kp/SequenceGenerator"
          *
          * @ejb:transaction type="Required"
          *
          * @ejb:finder signature="java.util.Collection findByName(java.lang.String first, java.lang.String last)"
          * result-type-mapping="Remote" query="SELECT OBJECT(o) FROM PatientEntity o WHERE o.firstName LIKE ?1 AND o.lastName = ?2"
          *
          * @jboss:table-name table-name="patient"
          *
          * @jboss:create-table create="true"
          *
          * @jboss:remove-table remove="false"

          For anyone else having problems, the QUERY does not take parameters from the relational table but from your EJB.

          For instance, my EJB has getFirstName, getLastName but those get/set's are mapped to patFirstName, patLastName. Also, my actual table name is patient, not PatientEntity ... PatientEntity is the name of my EJB.

          Hope this helps someone else as well.

          Jeremy Cowgar
          jc@cowgar.com