It's a very common situation within our programs that some entity need to be symbolized by an enum: for instance types, groups, status, and such things as that.

Frequently, you will find conditions or flows within the code which use the values to determine between one action or any other, therefore the values need to be "known" in some manner for that application (i.e. it needs to have the ability to make reference to a particular instance to determine rather than referencing the category inside a whole). That's why we use enums rather than only a regular class.

However , these organizations should also be saved (or at best recommended) within the database, as fields of other organizations. We usually produce a table for every entity, to manage to getting referencial integrity inspections during these posts, and that the information possess a "meaning" within the database alone with no need to make reference to the enum to discover what each id means.

Ideally, the information of these organizations ought to be populated in the data within the enum, but nowadays we now have the values copied within the db initialization scripts.

It might be a little more difficult when an ORM like Hibernate can be used.

Let me understand how others handles this type of situation.

I am not fully confident with the thought of getting a duplication between an enum along with a database table, however i haven't found a much better solution yet.

Try the solutions for this question: Methods to save enums in database

I have a similar problem for my JPA/Hibernate application. Things I do is dynamically produce the enum entry within the database as they are experienced. Within this maybe it was auto-populates when needed.