Corda-空列的自定义Vault查询不起作用
考虑以下国家:Corda-空列的自定义Vault查询不起作用,corda,Corda,考虑以下国家: 数据类示例(val编号:Int?,覆盖val参与者:列表):QueryableState{ 重写fun generateMappedObject(架构:MappedSchema):PersistentState=when(架构){ 是ExampleEntity.ExampleSchema.ExampleSchemaV1->ExampleEntity(数字=数字) else->抛出IllegalArgumentException(“无法识别的架构:$schema.”) } 重写受支
数据类示例(val编号:Int?,覆盖val参与者:列表):QueryableState{
重写fun generateMappedObject(架构:MappedSchema):PersistentState=when(架构){
是ExampleEntity.ExampleSchema.ExampleSchemaV1->ExampleEntity(数字=数字)
else->抛出IllegalArgumentException(“无法识别的架构:$schema.”)
}
重写受支持的模式():Iterable{
返回列表(ExampleEntity.ExampleSchema.ExampleSchemaV1)
}
}
也可以考虑以下实体:
@实体
@表(name=“示例_州”)
类示例实体(
@列(name=“number”,nullable=true)
val编号:Int?=null
):PersistentState(){…}
在查询中,我使用以下条件表达式:
ExampleEntity::number.equal(null)
这似乎无法正确查询number
的行条目为空的状态。我做错什么了吗?看来null和notnull是独立处理的。null的条件表达式为:
ExampleEntity::number.isNull()
因此,需要实现其他逻辑以正确执行查询:
expression=if(number==null){
ExampleEntity::number.isNull()
}否则{
ExampleEntity::number.equal(number)
}