Cannot query by primary key column #97

dstrawson opened this Issue Aug 2, 2012 · 5 comments


None yet
3 participants

I want to use the Id column in a query, for example:

SELECT t FROM Thing t WHERE = :idParam

(id is type Long, @id in the entity definition class)

(and before you ask, I know that there is a em.find() method of course, the above is a simplified version of a more complex query)

Kundera throws the following exception:

at com.impetus.kundera.metadata.model.EntityMetadata.getFieldType(
at com.impetus.kundera.query.KunderaQuery.filterJPAParameterInfo(
at com.impetus.kundera.query.KunderaQuery.onTypedParameter(
at com.impetus.kundera.query.KunderaQuery.initFilter(
at com.impetus.kundera.query.KunderaQuery.postParsingInit(
at com.impetus.kundera.query.QueryResolver.getQueryImplementation(
at com.impetus.kundera.persistence.PersistenceDelegator.createQuery(
at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(
at example.Test1.testQueryByPK(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
at org.junit.internal.runners.statements.RunBefores.evaluate(
at org.junit.internal.runners.statements.RunAfters.evaluate(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.ParentRunner.runChildren(
at org.junit.runners.ParentRunner.access$000(
at org.junit.runners.ParentRunner$1.evaluate(
at org.junit.internal.runners.statements.RunBefores.evaluate(
at org.junit.internal.runners.statements.RunAfters.evaluate(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(

I've updated dstrawson/kunderatest with this as a test case and pushed back to github.


mevivs commented Aug 2, 2012

Hi Daniel,
As query support over Cassandra works over Secondary index, Secondary indexes can be done over columns only!
Hence we have limited Kundera not to support. But team is working to convert such invocations in to "findById()" implicitly.

2.0.8 will have this change in. I would request you to let this open.


kkmishra was assigned Aug 2, 2012

I guess that this won't work as a range query, eg id>5 AND id<50 (with OPP this should work ok in CQL I think for example).


mevivs commented Aug 2, 2012

Yes. With OPP it should work with Kundera as well.


mevivs commented Jan 23, 2013

Working fine. Closing it

mevivs closed this Jan 23, 2013

kkmishra was unassigned by dstrawson Feb 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment