Uploaded image for project: 'Corda'
  1. CORDA-1338

Error with VaultQuery for entity inheriting from CommonSchemaV1.FungibleState

    Details

      Description

      Reported by Matthieu Merlyn via StackOverflow

      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

      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)
      

        Attachments

          Activity

            People

            • Assignee:
              removed86 Former user (Inactive)
              Reporter:
              chris.rankin Chris Rankin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: