I read a few times but still don't really understand.
One important thing though: To my knowledge,
CadastrosId is an auto-generated alias for Key Cadastros.
The id field is normally not in the model definition! It's auto-generated and it's always Int64 in Persistent.
So, to avoid name collissions, I strongly recommend to rename your custom Id field to e.g. id2.
You can add to your model definition:
id2 UUID sqltype=uuid …
UniqueId2 id2
The second line makes a unique index. Then you can use
getBy (UniqueId2 yourId)
To get your Id from an Entity, use this:
(cadastrosId2 . entityVal)
To get the real Int64 Persist Key, use entityKey
OK, the docs for Key rec say:
> By default, a backend will automatically generate the key
Instead you can specify a Primary key made up of unique values.
So this behavior might can be changed, but I'd stick to the default and can only recommend this article: