Hibernate : How to mapping a column with a enum type class ?

Look the example and see how mapping with hibernate annotation a enum type column.

Example :

/** User.java**/
@Table(name = "usuario")
public class User {
@Column(name = "perfil", length = 32)
@NotNull(message = "You need choose a perfil for this user")
private Perfil perfil;

/** Perfil Enum Class **/

public enum Perfil {

    private final String label;

    private Perfil(String label) {
        this.label = label;

    public String getLabel() {
        return label;



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s