我刚刚升级到datanucleus-core 3.2.10(3.3.5)并且突然对我的一个对象的简单查询不起作用,我似乎找不到原因。
我正在使用以下DN lib datanucleus-core 3.2.10 datanucleus-api-jdo 3.2.6 datanucleus-rdbms 3.2.9 datanucleus-jdo-query 3.0.2 datanucleus-googlecollections 3.2.2
我正在运行查询:
Query q = pm.newQuery(User.class);
q.declarParameters("String myKey");
q.setFilter("this.key == myKey");
List<User> results = (List<User>) q.execute("4762");
User.class的JDO文件
<jdo>
<package name="org.sly.main.shared.data.user">
<class name="User" detachable="true">
<inheritance strategy="new-table">
<discriminator strategy="value-map" value="USER_MAIN" />
</inheritance>
<version strategy="version-number" />
<unique name="unique_username">
<field name="username" />
</unique>
<field name="key" persistence-modifier="persistent"
value-strategy="increment" primary-key="true">
<column length="32" jdbc-type="VARCHAR" />
</field>
<field name="name" persistence-modifier="persistent" />
<field name="username" persistence-modifier="persistent" />
<field name="groups" persistence-modifier="persistent" default-fetch-group="true">
<join />
</field>
</class>
</package>
UserGroup.class的JDO文件
<jdo>
<package name="org.sly.main.shared.data.user.group">
<class name="UserGroup" detachable="true">
<version strategy="version-number" />
<field name="key" persistence-modifier="persistent"
value-strategy="increment" primary-key="true">
<column length="32" jdbc-type="VARCHAR" />
</field>
<field name="name" persistence-modifier="persistent" />
<field name="systemReference" persistence-modifier="persistent" />
<field name="exclusionGroupId" persistence-modifier="persistent" />
<field name="displayName" persistence-modifier="persistent" />
</class>
</package>
例外:
javax.jdo.JDODataStoreException: Iteration request failed : SELECT 'org.sly.main.shared.data.user.group.UserGroup' AS NUCLEUS_TYPE,`A1`.`DISPLAYNAME`,`A1`.`KEY`,`A1`.`NAME`,`A1`.`VERSION`,`A0`.`KEY_OID`,`A0`.`IDX` AS NUCORDER0 FROM `USER_GROUPS` `A0` INNER JOIN `USERGROUP` `A1` ON `A0`.`KEY_EID` = `A1`.`KEY` WHERE `A0`.`IDX` >= 0 AND EXISTS (SELECT `A0_SUB`.`KEY` AS `DN_APPID`,`A0_SUB`.`VERSION` AS `DN_VERSION`,`A0_SUB`.`DISCRIMINATOR` AS `DN_DISCRIM` FROM `USER` `A0_SUB` WHERE ((`A0_SUB`.`DISCRIMINATOR` = 'USER_MAIN' OR `A0_SUB`.`DISCRIMINATOR` = 'USER_INVESTOR_AMTD' OR `A0_SUB`.`DISCRIMINATOR` = 'USER_INVESTOR')) AND `A0_SUB`.`KEY` = ? AND `A0`.`KEY_OID` = `A0_SUB`.`KEY`) ORDER BY NUCORDER0
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
at org.datanucleus.api.jdo.JDOQuery.executeWithArray(JDOQuery.java:321)
at org.sly.main.server.service.general.PersistenceServiceImpl.executeQuery(PersistenceServiceImpl.java:767)
at org.sly.main.server.service.general.PersistenceServiceImpl.getManagementEntities(PersistenceServiceImpl.java:821)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy25.getManagementEntities(Unknown Source)
at org.sly.main.Gavytest.testStrategy(Gavytest.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
NestedThrowablesStackTrace:
java.sql.SQLException: No value specified for parameter 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.PreparedStatement.checkAllParametersSet(PreparedStatement.java:2613)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2588)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2512)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2261)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeQuery(ParamLoggingPreparedStatement.java:381)
at org.datanucleus.store.rdbms.SQLController.executeStatementQuery(SQLController.java:504)
at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:728)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1786)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1672)
at org.datanucleus.api.jdo.JDOQuery.executeWithArray(JDOQuery.java:312)
at org.sly.main.server.service.general.PersistenceServiceImpl.executeQuery(PersistenceServiceImpl.java:767)
at org.sly.main.server.service.general.PersistenceServiceImpl.getManagementEntities(PersistenceServiceImpl.java:821)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy25.getManagementEntities(Unknown Source)
at org.sly.main.Gavytest.testStrategy(Gavytest.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)