I'm performing a JDOQL query that could look a bit complex:
Query q = pm.newQuery(IxlTest.class, "id == :tId && parameterGroups.get(oGroup.key).contains(tp) && oGroup.contains(opt) && opt.displayInResults");
q.setResult("oGroup, opt");
vars.append(TestTypeOptionsGroup.class.getName() + " oGroup;");
vars.append(TestTypeOption.class.getName() + " opt;");
vars.append(TestParameterGroup.class.getName() + " tpGroup;");
vars.append(TestParameter.class.getName() + " tp;");
q.declareVariables(vars.toString());
System.out.println(q.execute(testId));
There is no reason that I can think of that DN would need that Geometry
class, as my classes have nothing to do with geometry. This is parameterGroups
mapping in IxlTest
@Persistent(defaultFetchGroup = "true", table = "ixl_test_parameter_groups_rel")
@Join(column = "test_fk", extensions = { @Extension(vendorName = "datanucleus", key = "primary-key", value = "false") })
@Key(types = { String.class }, column = "test_parameter_group_key", mappedBy = "name", dependent = "true")
@Value(types = { TestParameterGroup.class }, column = "test_parameter_group_fk", dependent = "true")
private Map<String, TestParameterGroup> parameterGroups;
These are TestParameterGroup
fields
@Persistent(primaryKey = "true", valueStrategy = IdGeneratorStrategy.IDENTITY)
private long id;
private String name;
private String key;
private boolean active;
@Column(name = "script_substitute")
private boolean scriptSubstitute;
@Column(name = "substitute_all")
private boolean substituteAll;
@Column(name = "script_value_when_checked")
private String scriptValueWhenChecked;
@Column(name = "script_value_when_unchecked")
private String scriptValueWhenUnChecked;
@Persistent(defaultFetchGroup = "true")
@Key(types = { String.class }, mappedBy = "key", dependent = "true")
@Value(types = { TestParameter.class }, column = "parameters_group_id", dependent = "true")
private Map<String, TestParameter> parameters;
These are TestParameter
fields
@Persistent(primaryKey = "true", valueStrategy = IdGeneratorStrategy.IDENTITY)
private long id;
private String key;
private String value;
private boolean active;
@Column(name = "script_substitute")
private boolean scriptSubstitute;
@Column(name = "substitute_all")
private boolean substituteAll;
I'm still building up my query but just to make sure nothing is wrong, I tried running it before completing the whole query and I got this exception:
javax.jdo.JDOException: Class "com.vividsolutions.jts.geom.Geometry" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:570)
at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:252)
Class "com.vividsolutions.jts.geom.Geometry" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class "com.vividsolutions.jts.geom.Geometry" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:245)
at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:410)
at org.datanucleus.store.rdbms.sql.expression.SQLExpressionFactory.invokeMethod(SQLExpressionFactory.java:382)
at org.datanucleus.store.rdbms.sql.expression.ObjectExpression.invoke(ObjectExpression.java:783)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:2871)
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:70)
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.execute(JDOQuery.java:243)
Why is DN thinking that I need any geo-based class ?
The query is simply weird (IMHO). You have
parameterGroups.get(oGroup.key).contains(tp)
yet "parameterGroups" is a Map, so "parameterGroups.get(...)" is a TestParameterGroup. Consequently what is "TestParameterGroup.contains" trying to do. Or "oGroup.contains(...)" also for that matter.
If you have that class being thrown in an exception then you either reference it, or you include all sorts of random jars in the classpath, such as "datanucleus-spatial" for example.