I have the following class:
@Entity
class User
{
@Id @GeneratedValue
private long id;
private Language lang; //Language is an Enum of all languages
private Role role; //Role is an enum of user roles like admin, super-admin, etc
}
My questions are:
1) How should I design the database column to work with the enum types? Should I use varchar, or any other type? (I'm using MySQL)
2) Will this class work out of the box, or do I need to do anything extra to make it work with Enums? I need to be able to both read, and write the enum values (e.g user can change his language)