Hi Shelly,
thanks for the info.
>
> Michael,
>
> You had requested information regarding IN expression at yesterday's
> meeting. Was it related to IN expression with a parameter or subquery or
> something else? My note from the meeting states: "other failures with
> IN clause?"
I was interested in test case using an IN expression with literals
and/or input parameters.
>
> I leave the implementation assessment to you here but wanted to note
> that I am seeing the subquery_join clause fail with where the stack
> trace comes from invalidQueryKeyInExpression also.
I think the exception below is not related to the IN expression issue.
However, this is an interesting test case which might be more related to
issue 140 (EJBQL: exception for subquery using outer identification
variable in the FROM clause).
Looking at the query I'm wondering whether it is legal for a subquery to
return a value not defined in its FROM clause. The subquery
SELECT o FROM o.lineItems l where l.quantity > 3
return o which is defined in the outer query. I think the spec does not
explicitly specify whether this is legal or not. Should I email Linda
and Mike about this?
The query works when changing the subquery to return the LineItem:
SELECT c FROM Customer c JOIN c.orders o WHERE EXISTS
(SELECT l FROM o.lineItems l where l.quantity > 3)
Regards Michael
>
> "SELECT c FROM Customer c JOIN c.orders o WHERE EXISTS "
> + "(SELECT o FROM o.lineItems l where l.quantity > 3 ) ")
> Local Exception Stack:
> Exception [TOPLINK-6015] (Oracle TopLink Essentials - 10g release 4
> (10.1.4.0.0) (Build 060104Dev)): oracle.toplink.essential
> s.exceptions.QueryException
> Exception Description: Invalid query key [orders] in expression.
> Query:
> ReportQuery(com.sun.ts.tests.ejb30.persistence.query.language.schema30.Customer)
> at
> oracle.toplink.essentials.exceptions.QueryException.invalidQueryKeyInExpression(QueryException.java:606)
> at
> oracle.toplink.essentials.internal.expressions.QueryKeyExpression.validateNode(QueryKeyExpression.java:685)
> at
> oracle.toplink.essentials.expressions.Expression.normalize(Expression.java:2475)
> at
> oracle.toplink.essentials.internal.expressions.DataExpression.normalize(DataExpression.java:343)
> at
> oracle.toplink.essentials.internal.expressions.QueryKeyExpression.normalize(QueryKeyExpression.java:464)
> at
> oracle.toplink.essentials.internal.expressions.QueryKeyExpression.normalize(QueryKeyExpression.java:451)
> at
> oracle.toplink.essentials.internal.expressions.RelationExpression.normalize(RelationExpression.java:469)
> at
> oracle.toplink.essentials.internal.expressions.CompoundExpression.normalize(CompoundExpression.java:164)
> at
> oracle.toplink.essentials.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1174)
> at
> oracle.toplink.essentials.internal.expressions.SubSelectExpression.normalizeSubSelect(SubSelectExpression.java:143
> )
> at
> oracle.toplink.essentials.internal.expressions.ExpressionNormalizer.normalizeSubSelects(ExpressionNormalizer.java:
> 102)
> at
> oracle.toplink.essentials.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1247)
> at
> oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.buildReportQuerySelectStatement(Express
> ionQueryMechanism.java:433)
> at
> oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.buildReportQuerySelectStatement(Express
> ionQueryMechanism.java:403)
> at
> oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.prepareReportQuerySelectAllRows(Express
> ionQueryMechanism.java:1225)
> at
> oracle.toplink.essentials.queryframework.ReportQuery.prepareSelectAllRows(ReportQuery.java:878)
> at
> oracle.toplink.essentials.queryframework.ReadAllQuery.prepare(ReadAllQuery.java:398)
>
> Michael Bouschen wrote On 01/13/06 09:26,:
>
>>Hi Tom,
>>
>>I think I have a fix for the EJBQL problem with an IN-expression
>>including an input parameter:
>> SELECT c From Customer c where c.home.city IN(:city)
>>
>>The fix changes the parse tree node InNode and removes the special
>>handling of input parameter. Now the InNode passes an array of
>>Expression instances to the backend instead of a Vector of constant
>>values. I added two methods to the Expression class: in and notIn both
>>taking an array of Expression instances.
>>
>>Thanks!
>>
>>Regards Michael