Reputation: 1319
I have a PurchaseOrder state
where the primary key would be PurchaseOrderID
and SupplierName
.
I have another LetterOfCredit state
which need to refer the above state so that we can get PurchaseOrder
from vault if we have LetterOfCredit state
.
PurchaseOrderID
and SupplierName
in
LetterOfCredit
also UniqueIdentifier
of the
PurchaseOrder state
in LetterOfCredit state
. transactionID
myself and store in both the states as a separate field.Which should be the correct way?
Question 2: If I go with second approach, than is it correct to generate UniqueIdentifier
from [external id
, id
] to query for the state from vault.
Thanks for any help.
Upvotes: 0
Views: 62
Reputation: 1470
If your purchaseOrder
state is a linear state then it's uniquely identified with it's linearId
which happens to be a UniqueIdentifier
. Now you can randomly generate the identifier from UniqueIdentifier()
or you can pass the externalId (which you would like to use to be in sync with your upstream systems) to it and to get back the uniqueIdentifier use UniqueIdentifier.fromString(externalId)
.
Go with the 2nd approach and get the UniqueIdentifier from externalId as stated above.
Upvotes: 2