3 Replies Latest reply on Dec 16, 2003 2:18 PM by Collin

    Cannot create EJB-QL in my entity beans

    Collin Novice

      I'm at a point now in the application where I really need some EJB-QL type finder methods for some of my entity beans.

      I use xdoclet to generate all of my EJB interfaces, and essentially would like to define methods such as this:

      @ejb.query
      signature="java.util.Collection findSome()"
      query="SELECT OBJECT(x) FROM EntitySchema AS X"

      Or something along those lines.

      However, whenever I define any query other than "java.util.Collection findAll()" I get some crazy errors upon deployment. They are usually not related (seemingly) to the query. For instance, when I add such a query to my BlockBean.java (entity EJB), I get an error when JBoss deploys saying another entirely different session bean needs to be defined as Stateful or Stateless, but it definitely is defined as Stateless. I don't get that error when I don't define my query.

      So I'm a little confused about this. I am under the impression that I only need to define my query in my entity bean as defined above.

      Is that correct, and it is possible that something else entirely is different?

      thanks!
      Collin

        • 1. Re: EJB-QL ERROR with 3.2.3 but working with 3.0.4
          Collin Novice

          Unfortunately it does not work. The error message is the same:

          jvm 1 | org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(c) FROM CustomerEJB
          AS c'; - nested throwable: (java.lang.NoSuchMethodError)
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:50)
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:59)
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:212)
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:490)
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)
          jvm 1 | at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
          jvm 1 | at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
          jvm 1 | at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
          jvm 1 | at $Proxy14.start(Unknown Source)
          jvm 1 | at org.jboss.system.ServiceController.start(ServiceController.java:394)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          jvm 1 | at $Proxy40.start(Unknown Source)
          jvm 1 | at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
          jvm 1 | at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
          jvm 1 | at $Proxy14.start(Unknown Source)
          jvm 1 | at org.jboss.system.ServiceController.start(ServiceController.java:394)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          jvm 1 | at $Proxy12.start(Unknown Source)
          jvm 1 | at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
          jvm 1 | at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
          jvm 1 | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
          jvm 1 | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          jvm 1 | at $Proxy6.deploy(Unknown Source)
          jvm 1 | at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
          jvm 1 | at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
          jvm 1 | at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner
          .java:201)
          jvm 1 | at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:27
          4)
          jvm 1 | at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
          jvm 1 | at $Proxy0.start(Unknown Source)
          jvm 1 | at org.jboss.system.ServiceController.start(ServiceController.java:394)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          jvm 1 | at $Proxy4.start(Unknown Source)
          jvm 1 | at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
          jvm 1 | at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
          jvm 1 | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
          jvm 1 | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
          jvm 1 | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
          jvm 1 | at java.lang.reflect.Method.invoke(Native Method)
          jvm 1 | at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
          jvm 1 | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
          jvm 1 | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          jvm 1 | at $Proxy5.deploy(Unknown Source)
          jvm 1 | at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
          jvm 1 | at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
          jvm 1 | at org.jboss.Main.boot(Main.java:150)
          jvm 1 | at org.jboss.Main$1.run(Main.java:395)
          jvm 1 | at java.lang.Thread.run(Thread.java:484)
          jvm 1 | + nested throwable:
          jvm 1 | java.lang.NoSuchMethodError
          jvm 1 | at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler.visit(JDBCEJBQLCompiler.java:932)
          jvm 1 | at org.jboss.ejb.plugins.cmp.ejbql.ASTSelect.jjtAccept(ASTSelect.java:25)


          Jens

          • 2. Re: Cannot create EJB-QL in my entity beans
            Tilo Thiele Newbie

            You should be more precise.
            Note, if JBoss finds an erroneous EJB-QL statement the deployment produces an avalance of error messages which are not directly related to the source. Only the first one tells you what is really wrong.

            Probably your example should look like

            @ejb.query
            signature="java.util.Collection findAll()"
            query="SELECT OBJECT(x) FROM EntitySchema x"

            or e.g.

            @ejb.query
            signature="java.util.Collection findSome(java.lang.String n)"
            query="SELECT OBJECT(x) FROM EntitySchema x WHERE x.name=?1"

            /tt

            • 3. Re: Cannot create EJB-QL in my entity beans
              Collin Novice

              Thanks for the advice, but I'm still having the problem. Specifically, here's the revised xdoclet tag I'm using:

              * @ejb.finder
              * signature="java.util.Collection findSome(java.lang.String n)"
              * query="SELECT OBJECT(x) FROM BlockSchema x WHERE x.name=?1"


              It comes back and tells me that another bean should be using either "Bean" or "Container" as its transaction type. That bean's transaction type is "Container" already.

              Confusing isn't it?

              thanks, and thanks for any additional help you all might be able to provide.

              Collin