Inserting Enum and their Values in Database Tables

Hi Cuba Team!

I have created a project where I have many Enum Fields. Here I have created a website for my Tool where I will Display the Data here and then route them to my Cuba Tool. Here I have been difficult for changing the enums to Values in my external Website. So it will be helpful to me where I can capture the Enum Data into the Separate Database Table.
When even I enter some data in enum it should also be added to the Config Table in the Database.
Here is the small Example of my Requirement.

Value Enum

Chickpea 1
Common beans 2
Pigeon Pea 3
Groundnut 4
Cowpea 5

Value Enum

Ethiopia 1
India 2
Tanzania 3
England 4
Austrailia 5
Newzeland 6
Sri Lanka 7

Is it possible to get database table like the below one

id || Field || EnumName || EnumValue +

xxxxx || CropENum || Chickpea || 1
xxxxx || CropENum || Common beans || 2
xxxxx || CropENum || Pigeon Pea || 3
xxxxx || CropENum || Groundnut || 4
xxxxx || CropENum || Cowpea || 5
xxxxx || CountryENum ||Ethiopia || 1
xxxxx || CountryENum || India || 2
xxxxx || CountryENum || Tanzania || 3
xxxxx || CountryENum || England || 4
xxxxx || CountryENum || Austrailia || 5
xxxxx || CountryENum || Newzeland || 6
xxxxx || CountryENum || Sri Lanka || 7

Hello, Dhanush,
as far as I know there is no a straight-forward way to do this, but you can implement an Entity to store this data (please consider the fact that CUBA uses two types of Enum - there are String-based and Integer-based Enums) and use Application Startup Listener to find all Enums loaded, get their constants and update you records.

Pay attention to the fact that it could be worth also storing captions for constants as well.