is it possible to let Hibernate (3.6) populate the database table with the values ββfor this listing? I have the following class:
@Entity public enum Role { ROLE_USER_FREE("ROLE_USER_FREE"), ROLE_USER_STANDARD("ROLE_USER_STANDARD"), ROLE_USER_PREMIUM("ROLE_USER_PREMIUM"), ROLE_ADMIN("ROLE_ADMIN"); ... constructor / setter / getter etc. }
I can use this enumeration without any problems from another entity class using
@Enumerated(EnumType.STRING) public Role getRole()
My question is: how can I automatically populate the appropriate ROLE table? All basic logic and definitions are in the XML specification. Of course, I can generate a sql file from this XSL specification and let Hibernate import it with import.sql sematic at startup ... But is there a more elegant way?
The table should look like this:
|RoleID|RoleName | | 0 |ROLE_USER_FREE| ....
source share