1

サブクエリ フィルタから、外部クエリを次のように参照します。

type.maxZoneTests > this.fromZone

Query freeZoneSubquery = pm.newQuery(Zone.class, sb.toString());
freeZoneSubquery.setResult("ip.trim()");
outerQuery.addSubquery(freeZoneSubquery, "List reservedZones", null);

しかし、メイン クエリを実行すると、次のエラーが発生します。

javax.jdo.JDOUserException: Query has reference to member "fromZone" of class "com.mg.ipk.Zone" yet this doesnt exist!
    at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:519)
    at org.datanucleus.api.jdo.JDOQuery.executeWithArray(JDOQuery.java:321)
    at com.ipkzen.ta.core.services.dao.ProcedureExecutionRecordDAOImpl.getEligibleTests(ProcedureExecutionRecordDAOImpl.java:83)
    at com.ipkzen.ta.core.services.dao.ProcedureExecutionRecordDAOImpl.main(ProcedureExecutionRecordDAOImpl.java:325)
NestedThrowablesStackTrace:
Query has reference to member "fromZone" of class "com.mg.ipk.Zone" yet this doesnt exist!
org.datanucleus.exceptions.NucleusUserException: Query has reference to member "fromZone" of class "com.mg.ipk.Zone" yet this doesnt exist!
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.getSQLTableMappingForPrimaryExpression(QueryToSQLMapper.java:2262)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processPrimaryExpression(QueryToSQLMapper.java:2114)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compilePrimaryExpression(AbstractExpressionEvaluator.java:180)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileUnaryExpression(AbstractExpressionEvaluator.java:169)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileAdditiveMultiplicativeExpression(AbstractExpressionEvaluator.java:148)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileRelationalExpression(AbstractExpressionEvaluator.java:123)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileOrAndExpression(AbstractExpressionEvaluator.java:65)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.evaluate(AbstractExpressionEvaluator.java:46)
    at org.datanucleus.query.expression.Expression.evaluate(Expression.java:337)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:70)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:70)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compileFilter(QueryToSQLMapper.java:461)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compile(QueryToSQLMapper.java:381)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processVariableExpression(QueryToSQLMapper.java:3275)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:2745)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compilePrimaryExpression(AbstractExpressionEvaluator.java:200)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileUnaryExpression(AbstractExpressionEvaluator.java:169)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileAdditiveMultiplicativeExpression(AbstractExpressionEvaluator.java:148)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileRelationalExpression(AbstractExpressionEvaluator.java:123)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileOrAndExpression(AbstractExpressionEvaluator.java:65)
    at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.evaluate(AbstractExpressionEvaluator.java:46)
    at org.datanucleus.query.expression.Expression.evaluate(Expression.java:337)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:70)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:67)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compileFilter(QueryToSQLMapper.java:461)
    at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compile(QueryToSQLMapper.java:381)
    at org.datanucleus.store.rdbms.query.JDOQLQuery.compileQueryFull(JDOQLQuery.java:883)
    at org.datanucleus.store.rdbms.query.JDOQLQuery.compileInternal(JDOQLQuery.java:343)
    at org.datanucleus.store.query.Query.executeQuery(Query.java:1747)
    at org.datanucleus.store.query.Query.executeWithArray(Query.java:1666)
    at org.datanucleus.api.jdo.JDOQuery.executeWithArray(JDOQuery.java:312)
    at com.ipkzen.ta.core.services.dao.ProcedureExecutionRecordDAOImpl.getEligibleTests(ProcedureExecutionRecordDAOImpl.java:83)
    at com.ipkzen.ta.core.services.dao.ProcedureExecutionRecordDAOImpl.main(ProcedureExecutionRecordDAOImpl.java:325)

結合を実行できる場合にのみ回避できますが、JDO ではサブクエリのインポート、変数、パラメーターの宣言が許可されていないことがわかっています。

4

1 に答える 1

0

JDO仕様とDNドキュメントは、そのすべてを十分に定義してい ますhttp://www.datanucleus.org/products/accessplatform_3_1/jdo/jdoql_subquery.html

于 2012-10-21T07:36:53.213 に答える