Follow this forum "monologue":
It seems that the JBoss EJB-QL parser/compiler gets confused by the use of "Order" as the abstract-schema. I would get the following error when trying query "SELECT COUNT(o) FROM Order o":
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.
What I believe is happening is that JBoss mistankenly parses "Order" as the query keword ORDER. Initially I thought this was the fault of my query statement which I pulled out of the EJB2.1 Spec. I contacted the spec contact, and Linda DeMichiel replied to me noting that in fact "Order" should be OK for the abstract-schema and is only restriced in use as an identifier.