Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] MIN/MAX aggregate functions do not accept arithmatic expressions.

Please log this bug.  We should support this.



Pinaki Poddar wrote:
> 
> Hi,
>   MIN/MAX aggregate functions do not accept arithmatic expressions. This
> is *not* a bug from spec view point.
>   But just thought will be useful to support.
>   A query to compute maximum and minimum Inventory
> 
>     select new openbook.util.Range(MIN(i.supplied - i.sold),
> MAX(i.supplied - i.sold)) from Inventory i
> 
>   breaks with following stacktrace:
> 
>      [java] Exception Description: Syntax error parsing the query [select
> new openbook.util.Range(MIN(i.supplied - i.sold), MAX(i.supplied -
> i.sold)) from Inventory i], line 1, col
> umn 46: syntax error at [-].
>      [java] Internal Exception: MismatchedTokenException(90!=82)
>      [java]     at
> org.eclipse.persistence.exceptions.JPQLException.syntaxErrorAt(JPQLException.java:362)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.handleRecognitionException(JPQLParser.java:304)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:245)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.reportError(JPQLParser.java:362)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.aggregateExpression(JPQLParser.java:2552)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.constructorItem(JPQLParser.java:3317)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.constructorExpression(JPQLParser.java:2597)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectExpression(JPQLParser.java:2045)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectItem(JPQLParser.java:1351)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectClause(JPQLParser.java:1266)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectStatement(JPQLParser.java:352)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.document(JPQLParser.java:276)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:133)
>      [java]     at
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:94)
>      [java]     at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:198)
>      [java]     at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:173)
>      [java]     at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:125)
>      [java]     at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:109)
>      [java]     at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1326)
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/MIN-MAX-aggregate-functions-do-not-accept-arithmatic-expressions.-tp27410050p27421827.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top