[
https://issues.apache.org/jira/browse/OPENJPA-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ravi P Palacherla updated OPENJPA-997:
--------------------------------------
Attachment: TestEJBQLFunction1.java
Drop the attached file under
openjpa-persistence-jdbc\src\test\java\org\apache\openjpa\persistence\jpql\functions.
Make sure to point to SQL Server while running the test case and you will see
the excpeption.
> JPQL with MAX and SIZE together throws an error on MS SQLserver
> ---------------------------------------------------------------
>
> Key: OPENJPA-997
> URL: https://issues.apache.org/jira/browse/OPENJPA-997
> Project: OpenJPA
> Issue Type: Bug
> Components: query, sql
> Affects Versions: 2.0.0
> Environment: MS SQL Version: SQL Server 2000 SP3
> JDBC driver : Microsoft SQL Server 2000 Driver for JDBC
> Reporter: Ravi P Palacherla
> Attachments: TestEJBQLFunction1.java
>
>
> Run the JPQL "SELECT MAX(SIZE(d.slist)) FROM Department d" on SQLServer fail
> with error.
> But it works fine on other database like Oracle.
> Here is the error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Cannot perform
> an
> aggregate function on an expression containing an aggregate or a subquery.
> {prep
> stmnt 8926039 SELECT MAX((SELECT COUNT(*) FROM STUD_DEP WHERE
> STUD_DEP.DEP_ID =
> t0.id)) FROM Department t0} [code=130, state=S1000]
> at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingCo
> nnectionDecorator.java:193)
> at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(Log
> gingConnectionDecorator.java:58)
> at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnect
>
> ion$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:967)
> at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(
> DelegatingPreparedStatement.java:262)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStateme
> nt.executeQuery(JDBCStoreManager.java:1542)
> at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(
> DelegatingPreparedStatement.java:252)
> at
> org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:4
> 69)
> at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:382)
> at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:350)
> at
> org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalU
> nion.java:426)
> at
> org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:22
> 9)
> at
> org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:21
> 9)
> at
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(Select
> ResultObjectProvider.java:94)
> at
> org.apache.openjpa.kernel.QueryImpl$PackingResultObjectProvider.open(
> QueryImpl.java:1999)
> at
> org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1283)
>
> at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1220)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:989)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
> ... 33 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.