Jak poprawnie dodać enum z encji do bazy danych. Mój kod:
@Entity
@Table(name="tourist")
public class Tourist implements Serializable{
private static final long serialVersionUID =1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_tourist")
private Long id;
@Column(name="firstname", nullable=false)
private String firstName;
@Column(name="lastname", nullable=false)
private String lastName;
@Column(nullable=false)
private Gender gender;
@Column(nullable=false)
private String country;
@Column(length=512)
private String note;
@Column(name="dateofbirth", nullable=false)
private String dateOfBirth;
public Tourist() {}
public Tourist(String firstName, String lastName, Gender gender, String country, String note, String dateOfBirth) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.gender = gender;
this.country = country;
this.note = note;
this.dateOfBirth = dateOfBirth;
}
//getters & setters
public enum Gender {
FEMALE, MALE;
}