1 Reply Latest reply on May 28, 2003 9:22 AM by Chris

    Aggregate functions (COUNT, MAX, etc.) do not work. Why?

    btud Newbie

      Hello!

      I have the following problem:

      I tried to make a select method which returns me the total number of rows.

      The EJB-QL looked like this:

      "SELECT COUNT(t) FROM Transaction t"

      When deployed jBoss throws a ParseError (something like
      "COUNT encountered when
      OBJECT,
      DISTINCT,
      <..._PATH>,
      <..._PATH>,
      .....,
      expected"

      The same thing happens with other aggregate functions (I tried with MAX also).

      I was forced to implement a separate method which acceses the database directly through JDBC (not recommended when using CMP though).

      What can be the reason for this and is there a way of dealing with it, without writing JDBC code inside the bean?

      Thanks,

      Bogdan.