本文介绍了Corda:error = org.hibernate.InstantiationException:没有实体的默认构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,请提供帮助.基于M13的Corda代码.我的模式代码主要是使用定义模式来参考您的示例.

I met a issue, please to help. Corda Code based on M13. My Schema code this is mainly use define a schema refer your sample.

object LegalContractSchemaV1 : MappedSchema(
        schemaFamily = LegalContractSchema.javaClass,
        version = 1,
        mappedTypes = listOf(PersistentLegalContractState::class.java)) {

    @Entity
    @Table(name = "legal_contract_states")
       class PersistentLegalContractState(
            @Column(name = "contract_title`enter code here`")
            var contractTitle: String,

            @Column(name = "sender_name")
            var senderName: String,

            @Column(name = "recipient_name")
            var recipientName: String,

            @Column(name = "status")
            var status: String) : PersistentState(){
      //  constructor(stateRef: StateRef) :  this(stateRef.txhash.bytes.toHexString(), stateRef.index)
    }

推荐答案

kotlin-noarg插件为已使用选定注释进行注释的类生成默认构造函数.

kotlin-noarg plugin generates default construtors for classes that have been annotated with selected annotations.

为带注释的@Entity申请Kotlin-jpa插件以生成默认构造函数.

Apply for Kotlin-jpa plugin for annotated @Entity to generated default construtor.

将脚本添加到gradle文件

Add the scripts to gradle file

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
    }
}

apply plugin: "kotlin-jpa"

这篇关于Corda:error = org.hibernate.InstantiationException:没有实体的默认构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:32