奇怪的“com.vividsolutions.jts.geom.Geometry”ClassNotResolvedException异常

时间:2013-03-04 19:49:16

标签: datanucleus jdoql

我正在执行看起来有点复杂的JDOQL查询:

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));

我没有理由认为DN需要Geometry类,因为我的类与几何无关。这是[{1}}

中的parameterGroups映射
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; 字段

TestParameterGroup

这些是@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; 字段

TestParameter

我仍在构建我的查询,但只是为了确保没有错,我在完成整个查询之前尝试运行它并且我得到了这个例外:

@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;

为什么DN认为我需要任何基于地理位置的课程?

1 个答案:

答案 0 :(得分:1)

查询很奇怪(恕我直言)。

parameterGroups.get(oGroup.key).contains(tp)

但是“parameterGroups”是一个Map,因此“parameterGroups.get(...)” TestParameterGroup 。因此“TestParameterGroup.contains”试图做什么。或者“oGroup.contains(...)”也就此而言。

如果您在异常中抛出该类,则可以引用它,或者在类路径中包含各种随机jar,例如“datanucleus-spatial”。