I'm trying to implement a simple query method in a small EJB component of the "Petstore" app.
#1 I've got an 'public abstract int ejbHomeOrderCount()' in my OrderEJB.java
#2 I've got an 'int orderCount()' in my OrderLocalHome.java
#3 I've stuck the following into my ejb-jar.xml:
... <cmp-field>s ...
< query> (without the space here it doesn't show up on the forum :) haha)
<ejb-ql>SELECT COUNT(o) FROM Order o</ejb-ql>
JBoss (that rat! ;) ) keeps complaining in an onslaught of errors about:
org.jboss.deployment.DeploymentException: Query method not found: ejbHomeOrderCount()
ARGH!!! It's there!
Any help/suggestions are much appreciated. Thanks,
Well, I've fiddled around with my EJB, separating the orderCount into an ejbHomeOrderCount and ejbSelectOrderCount. I assume that this is the correct (and only) way to do it in the first place.
... but now I've got a different error:
org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT COUNT(o) FROM Order o'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Order" at line 1, column 22.
I've seen this pop up before but it "spontaneously" dissapeared. I've looked into it, and I know my ejb-ql syntax is right as I also found it right in the EJB 2.1 _Spec_ (220.127.116.11):
SELECT COUNT(o) FROM Order o
If You look at my previous post You'll not that I have an abstract-schema Order defined.
The joys of 'doing' EJBs... aaahhhh
In continueing my monologue on this forum ;) :
Seeing as the parser is case unsensitive, it turns out "Order" is a reserved identifier. To the best of my knowldege all things SQL related are case unsensitive... I've got a nagging want to send those EJB Spec authors a little note, that _EXACT_ query is in the spec!