How to generate UUID as Id value for entity

1
I am trying to set UUID value for my ids for each entity. I am going to use External Database, mysql. Shall I set dataType of my id as String? How do I generate UUID? Do I need to use module in a marketplace? I searched in forum and there are some answers about UUID but recommended use 'snowflake ID' using mendix internal DB
asked
2 answers
3

If you need to generate a UUID, you can use the RandomHash action from the Community Commons module in the Marketplace.

 

Good luck!

answered
0

Hi there,

 

There are various ways to solve this issue.

 

One way would be to have a string attribute and use the Java Action in CommunityCommons to generate an random hash for you. You would still need to check the uniqueness of it though.

 

Alternatively, each Mendix object has an ID (of type Long) that is unique per object. You can not directly access it, however you can use the Java Action in CommunityCommons call 'getGUID' to obtain this ID. This ID is generated by the Mendix process.

 

Hope it helps!

answered