DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-422
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Generic compilation : Compilation of JPQL "FROM" doesn't support subqueries candidate being a multi-level PrimaryExpression

Created: 04/Nov/09 09:37 PM   Updated: 26/Dec/09 12:57 PM   Resolved: 05/Nov/09 12:03 PM
Component/s: Queries
Affects Version/s: 1.1.6, 2.0.0.m1, 2.0.0.m2, 2.0.0.m3
Fix Version/s: 2.0.0.m4


 Description  « Hide
The JPQL
SELECT DISTINCT c FROM Customer c WHERE EXISTS (SELECT o FROM c.orders o where o.totalPrice BETWEEN 1000 AND 1200)

is being compiled as
  [from:ClassExpression(alias=c)]
  [filter:SubqueryExpression{EXISTS(VariableExpression{DATANUCLEUS_SUBQUERY_1})}]
  [symbols: DATANUCLEUS_SUBQUERY_1 type=unknown, c type=com.sun.ts.tests.ejb30.persistence.query.language.schema30.Customer]
  [subquery: DATANUCLEUS_SUBQUERY_1
    [from:ClassExpression(alias=o)]
    [filter:DyadicExpression{DyadicExpression{PrimaryExpression{o.totalPrice} <= Literal{1200}} AND DyadicExpression{PrimaryExpression{o.totalPrice} >
= Literal{1000}}}]
    [symbols: o type=com.sun.ts.tests.ejb30.persistence.query.language.schema30.Order]]

i.e the FROM of the subquery is incorrect, showing no sign of "c.orders"

Andy Jefferson added a comment - 05/Nov/09 12:03 PM
SVN trunk now resolves this, with the compiled expression for the subquery including

[from:ClassExpression(candidate=c.orders alias=o)]

hence any datastore-specific query has all information necessary to generate its query

Andy Jefferson made changes - 05/Nov/09 12:03 PM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 26/Dec/09 12:57 PM
Status Resolved [ 5 ] Closed [ 6 ]