Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

Annotations using enumerated

Otávio Santana edited this page Aug 7, 2013 · 7 revisions

Annotations using enumerated in a class.

Person class

@Entity(nome = "person")
public class Person implements Serializable {

private static final long serialVersionUID = 3L;

@Id
private Long id;

@Column(nome = "name")
private String name;

@Column(nome = "born")
private Integer year;

@Enumerated
@Column(nome="sex")
private Sex sex;

//getter and setter
}

The enum:

public enum Sex {
 MALE,FEMALE 
}

Clone this wiki locally