Error with VaultQuery for entity inheriting from CommonSchemaV1.FungibleState

Description

Reported by Matthieu Merlyn via StackOverflow

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 class VaultQueryTests { ... @Test fun queryCash() { database.transaction { val sum = builder { SampleCashSchemaV2.PersistentCashState::quantity.sum( groupByColumns = listOf(SampleCashSchemaV2.PersistentCashState::currency), orderBy = Sort.Direction.ASC ) } val criteria = VaultCustomQueryCriteria(sum) vaultService.queryBy<FungibleAsset<*>>(criteria) } } ... }

results in

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 net.corda.core.node.services.VaultQueryException: Please register the entity 'net.corda.core.schemas.CommonSchemaV1' See https://docs.corda.net/api-persistence.html#custom-schema-registration for more information at net.corda.node.services.vault.HibernateQueryCriteriaParser.parseCriteria(HibernateQueryCriteriaParser.kt:417) at net.corda.core.node.services.vault.QueryCriteria$VaultCustomQueryCriteria.visit(QueryCriteria.kt:152) at net.corda.core.node.services.vault.QueryCriteria$VaultCustomQueryCriteria.visit(QueryCriteria.kt:146) at net.corda.node.services.vault.HibernateQueryCriteriaParser.parse(HibernateQueryCriteriaParser.kt:427) at net.corda.node.services.vault.NodeVaultService._queryBy(NodeVaultService.kt:401) at net.corda.node.services.vault.VaultQueryTests$queryCash$1.invoke(VaultQueryTests.kt:2130) at net.corda.node.services.vault.VaultQueryTests$queryCash$1.invoke(VaultQueryTests.kt:47) at net.corda.nodeapi.internal.persistence.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:148) at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:134) at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:120) at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:127) at net.corda.node.services.vault.VaultQueryTests.queryCash(VaultQueryTests.kt:147) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239) at net.corda.testing.core.SerializationEnvironmentRule$apply$1$evaluate$1.invoke(SerializationTestHelpers.kt:62) at net.corda.testing.core.SerializationEnvironmentRule$apply$1$evaluate$1.invoke(SerializationTestHelpers.kt:61) at net.corda.testing.common.internal.CommonSerializationTestHelpersKt.asContextEnv(CommonSerializationTestHelpers.kt:11) at net.corda.testing.core.SerializationEnvironmentRule.runTask(SerializationTestHelpers.kt:72) at net.corda.testing.core.SerializationEnvironmentRule.access$runTask(SerializationTestHelpers.kt:36) at net.corda.testing.core.SerializationEnvironmentRule$apply$1.evaluate(SerializationTestHelpers.kt:62) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:748)

Status

Assignee

Michele Sollecito

Reporter

Chris Rankin

Priority

Medium

Labels

Severity

Medium

Fix versions

Ported to...

None

Feature Team

Corda Core