'Spring Boot - Enums when to use?
I have a User Entity that has Nationality and Gender as properties. What is the best pratice? Use Enums for that or have a separated table?
I also plan to send all the Nationalities and Genders back to the frontend as json data.
Thank you.
Solution 1:[1]
I would suggest using enums if the properties are not frequently updated
Solution 2:[2]
I would personally start with an enum if I find that I'm updating it too often or need other people to update it that would be a good time to transition it to a table.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | charlb |
| Solution 2 | Todoy |
