I use Corda 4.1 and kotlin. My goal is to store some data to Corda databse using Persistence API and then do some queries(I follow the doc https://docs.corda.net/api-persistence.html ). I have small problem with querying enumerated types.
This enum
@CordaSerializable
enum class MyEnum {
A,
B,
C
}
is stored in the database table as integer values 0 1 2 And it looks like A corresponds 0, B corresponds 1, and C correponds 2.
But I do not see any explicit mappings. What rules are used to serialize enum values? can they be changed with some annotations?
Is there any simple way of ensuring that A enum value will be always saved as 0 in the database? Is it possible to persist just "A", "B", "C" directly instead of numbers?
I could do this maually implenmenting this logic in generateMappedObject function, but I am curious what is the right way