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
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?
The current EJB2.0 spec does not support the aggregate functions you mention, and thus you have no choice but to use JDBC or to use basic EJB-QL (and then use java to do what you require).
To my knowledge, the latest spec EJB2.1 (which is in public draft final), does support these aggregate functions.