此问题类似于此处发布的问题:Corda: error=org.hibernate.InstantiationException: No default constructor for entity
对于扩展FungibleState的自定义架构,我遇到了同样的错误(如API Vault Query documentation中所述):
object CustomSchemaV1 : MappedSchema(schemaFamily = CustomSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCustomState::class.java))
{
@Entity
@Table(name = "custom_states", indexes = arrayOf(Index(name = "custom_field_idx", columnList = "custom_field")))
class PersistentCustomState(
/** Custom attributes */
@Column(name = "custom_field")
var customField: String? = null,
/** FungibleState parent attributes */
@Transient
val _participants: Set<AbstractParty>,
@Transient
val _owner: AbstractParty,
@Transient
val _quantity: Long,
@Transient
val _issuerParty: AbstractParty,
@Transient
val _issuerRef: OpaqueBytes
) : CommonSchemaV1.FungibleState(_participants?.toMutableSet(), _owner, _quantity, _issuerParty, _issuerRef.bytes)}
我安装了kotlin-jpa
插件。使所有字段都可以为空可以解决扩展PersistentState
的模式的问题,但由于FungibleState
父字段数据类型,这里不是一个选项。
Corda发布版本= 2.0.0
答案 0 :(得分:0)
您需要在R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 yaml_2.1.16
的正文中添加默认构造函数。类似的东西:
PersistentCustomState
难点在于传递constructor() : this(*first default value*, *second default value*, etc.)
参数的默认值。你可以使用类似的东西:
AbstractParty