How to use Enum members in a Hibernate @Entity class?


This question already has an answer here:


You can use the VARCHAR type and in the @Entity class mark the enum members with the @Enumerated and the @Column annotations (to point to which database table column will the enum member binded).

For example:

@Column(columnDefinition = "enum('BULGARIA','UNITED KINGDOM')")
private Language lang;

@Column(columnDefinition = "enum('ADMIN','USER')")
private Role role;

Need Your Help

XML error at ampersand (&)

php mysql html xml database

I have a php file which prints an xml based on a MySql db.

Crystal report - how to add image to background crystal-reports watermark

I have a list of names that I pass through stored procedure in my report.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.