openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-566) OpenJPA not supporting count(*) syntax
Date Wed, 09 Apr 2008 23:30:05 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587422#action_12587422
] 

Patrick Linskey commented on OPENJPA-566:
-----------------------------------------

I do not believe that that is legal JPQL. From spec section 4:

aggregate_expression ::= 
    { AVG | MAX | MIN | SUM } ([DISTINCT] state_field_path_expression) | 
    COUNT ([DISTINCT] identification_variable | state_field_path_expression | 
        single_valued_association_path_expression) 

My read of that is that you have to do things like 'select count(p) from Product p'.

> OpenJPA not supporting count(*) syntax
> --------------------------------------
>
>                 Key: OPENJPA-566
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-566
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.2
>         Environment: Spring 2.5.3, JDK 1.5.
>            Reporter: Mathias Bogaert
>            Priority: Blocker
>
> When executing a simple query using the (assumingly) valid count(*) syntax, accepted
by Hibernate, OpenJPA throws an exception.
> Caused by: <openjpa-1.0.2-r420667:627158 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
An error occurred while parsing the query filter 'SELECT count(*) FROM Order instance'. Error
message: <openjpa-1.0.2-r420667:627158 nonfatal user error> org.apache.openjpa.kernel.jpql.ParseException:
Encountered "*" at character 14, but expected: ["(", "+", "-", ":", "?", "ABS", "AVG", "COUNT",
"DISTINCT", "LENGTH", "LOCATE", "MAX", "MIN", "MOD", "SELECT", "SIZE", "SQRT", "SUM", <DECIMAL_LITERAL>,
<IDENTIFIER>, <INTEGER_LITERAL>].
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:1665)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:1645)
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:47)
> 	at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:144)
> 	at org.apache.openjpa.datacache.QueryCacheStoreQuery.newCompilation(QueryCacheStoreQuery.java:236)
> 	at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:651)
> 	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:633)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:599)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:661)
> 	at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1487)
> 	at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
> 	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
> 	at com.toyota.tme.jpapoc.dao.GenericDaoJpa$7.doInJpa(GenericDaoJpa.java:416)
> 	at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:184)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message