1 Reply Latest reply on Jun 22, 2004 4:37 AM by Alexey Loubyansky

    problem with MAX function in ejb-ql

    ashishabrol Newbie

      Hi friends

      please help me out with this ejb-ql. I have seen on some of the sites that MAX function is there .

      this is a method in the ejb-jar file
      ********************************

      <query-method>
      <method-name>findMaxSeq</method-name>
      <method-params>
      <method-param>java.lang.Long</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT MAX(c.addSeq) FROM CandidateAdd AS c WHERE c.candidateId= ?1</ejb-ql>

      ********************************


      But when I deploy the jar file containing the ejb-jar.xml i get the following error when it tries to compile the ejb-ql

      -----------------------------------------------
      14:22:13,859 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT MAX(c.addSeq) FROM CandidateAdd AS c WHERE c.candidateId= ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "MAX" at line 1, column 8.
      Was expecting one of:
      "DISTINCT" ...
      "OBJECT" ...
      <NUMERIC_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <BOOLEAN_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:50)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:59)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:212)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:490)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor258.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy15.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy363.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor258.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy15.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor31.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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "MAX" at line 1, column 8.
      Was expecting one of:
      "DISTINCT" ...
      "OBJECT" ...
      <NUMERIC_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <BOOLEAN_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...

      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.generateParseException(EJBQLParser.java:3858)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.jj_consume_token(EJBQLParser.java:3739)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.SelectClause(EJBQLParser.java:335)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.EJBQL(EJBQLParser.java:98)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.parse(EJBQLParser.java:60)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler.compileEJBQL(JDBCEJBQLCompiler.java:145)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:42)
      ... 56 more
      14:22:14,187 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=local/CompanyMst,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT MAX(c.addSeq) FROM CandidateAdd AS c WHERE c.candidateId= ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "MAX" at line 1, column 8.
      Was expecting one of:
      "DISTINCT" ...
      "OBJECT" ...
      <NUMERIC_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <BOOLEAN_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:50)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:59)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:212)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:490)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor258.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy15.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy363.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor258.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy15.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor31.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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "MAX" at line 1, column 8.
      Was expecting one of:
      "DISTINCT" ...
      "OBJECT" ...
      <NUMERIC_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <BOOLEAN_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...

      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.generateParseException(EJBQLParser.java:3858)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.jj_consume_token(EJBQLParser.java:3739)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.SelectClause(EJBQLParser.java:335)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.EJBQL(EJBQLParser.java:98)
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.parse(EJBQLParser.java:60)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler.compileEJBQL(JDBCEJBQLCompiler.java:145)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:42)
      ... 56 more
      14:22:14,562 INFO [StatelessSessionInstancePool] Started jboss.j2ee:jndiName=SessionEJBGenCandInfo,plugin=pool,service=EJB
      -----------------------------------------------