Home » Support » Forum » Distinct Error

Distinct Error

#1

Hi,

I'm getting a NullPointerException thrown on using DISTINCT. The query works fine if I don't have distinct. However thats NOT a solution as the code generating the query is used for other queries, and some of them do need the distinct. Its only a simple query:

QUERY: SELECT DISTINCT $1 FROM CDI $1 JOIN $1.attributeList $2 WHERE ($2.name='firstname') AND ($2.valueAsString='Alex')

The interesting thing is I can't reproduce this in the simple test project I have supplied for other bugs. This query succeeds happily in the test project (however thats just using the above string). The above query printout came from a CriteriaQuery.toString. The Query was built up using the CriteriaBuilder.


11:30:49.764 [main] ERROR c.c.handlers.SearchRequestHandler - Exception thrown during search request
com.contextspace.services.exception.ServicesException: Failed during CDI search: Unexpected internal exception
at com.contextspace.services.CDIService.search(CDIService.java:109) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at $Proxy69.search(Unknown Source) ~[na:na]
at com.contextspace.handlers.SearchRequestHandler.handleRequest(SearchRequestHandler.java:71) ~[classes/:na]
at com.contextspace.handlers.SearchRequestHandlerTest.testSearchSingleAttribute(SearchRequestHandlerTest.java:135) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit-4.8.2.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.8.2.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.8.2.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) [junit-4.8.2.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) [junit-4.8.2.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-4.8.2.jar:na]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) [junit-4.8.2.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit-4.8.2.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: com.objectdb.o.InternalException: Unexpected internal exception
at com.objectdb.o.JPE.h(JPE.java:163) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.ERR.f(ERR.java:68) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1448) ~[objectdb-2.2.8.jar:na]
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:633) ~[objectdb-2.2.8.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]
at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310) ~[spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at $Proxy74.getResultList(Unknown Source) ~[na:na]
at com.contextspace.dao.impl.BaseDAOImpl.SearchByLdapFilter(BaseDAOImpl.java:491) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at $Proxy22.SearchByLdapFilter(Unknown Source) ~[na:na]
at com.contextspace.services.CDIService.search(CDIService.java:106) ~[classes/:na]
... 34 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.objectdb.o.BQI.Vf(BQI.java:140) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.RQI$h._h(RQI.java:286) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.RQI.Vf(RQI.java:151) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.MQI.Vf(MQI.java:143) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.PRG.ad(PRG.java:698) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.PRG.ab(PRG.java:627) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.QRM.US(QRM.java:259) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.MST.US(MST.java:884) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.WRA.US(WRA.java:286) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.WSM.US(WSM.java:113) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.QRR.g(QRR.java:225) ~[objectdb-2.2.8.jar:na]
at com.objectdb.o.QRR.b(QRR.java:144) ~[objectdb-2.2.8.jar:na]
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:627) ~[objectdb-2.2.8.jar:na]
... 49 common frames omitted

 

#2

Appears this has been fixed in 2.2.8_06, I was only using 2.2.8_02

#3

OK. Maybe it is related to some of the bugs that were fixed in the last builds.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login