如何在cordapp中提到H2数据库表的主键(How to mention the primary key of H2 database table in a cordapp)

编程入门 行业动态 更新时间:2024-10-27 05:23:22
如何在cordapp中提到H2数据库表的主键(How to mention the primary key of H2 database table in a cordapp)

我遵循cordapp示例代码并创建了IOU。 任何人都可以让我知道我在哪里可以看到它的H2数据库的主键? 我如何更新以拥有复合键?

I am following the cordapp example code and created IOUs. Can anyone please let me know where can I see the primary key of its H2 database ? How Can I update to have a composite key ?

最满意答案

IOUState的数据库模式在IOUState定义: https : //github.com/corda/cordapp-example/blob/release-V3/kotlin-source/src/main/kotlin/com/example/schema/IOUSchema.kt 。

所有状态模式都必须继承PersistentState 。 PersistentState将状态表的主键设置为PersistentStateRef实例的组合键。 PersistentStateRef结合了:

生成状态的事务的散列 该州的交易产出指数

从Corda 3开始,您不能将状态表更改为使用不同的主键。

The database schema for IOUState is defined here: https://github.com/corda/cordapp-example/blob/release-V3/kotlin-source/src/main/kotlin/com/example/schema/IOUSchema.kt.

All state schemas must subclass PersistentState. PersistentState sets the state table's primary key to a composite key which is an instance of PersistentStateRef. PersistentStateRef combines:

The hash of the transaction that generated the state The state's index in the outputs of that transaction

As of Corda 3, you cannot change the state's table to use a different primary key.

更多推荐

本文发布于:2023-07-14 23:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1108330.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主键   数据库   如何在   cordapp   table

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!