Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package th.co.geniustree.advisor.domain; import java.io.Serializable; import java.util.Date; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotBlank; import org.springframework.format.annotation.DateTimeFormat; /** * * @author Best */ @Entity @Table(name = "APPOINTMENT") public class Appointment implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @DateTimeFormat(pattern = "dd-MM-yyyy HH:mm") @Temporal(TemporalType.TIMESTAMP) @NotNull(message = "?") private Date starttime; @DateTimeFormat(pattern = "dd-MM-yyyy HH:mm") @Temporal(TemporalType.TIMESTAMP) @NotNull(message = "?") private Date endtime; @NotBlank(message = "Detail ") private String detail; @NotBlank(message = "Teacher ") private String teacher; @NotBlank(message = "Student ") private String student; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getStarttime() { return starttime; } public void setStarttime(Date starttime) { this.starttime = starttime; } public Date getEndtime() { return endtime; } public void setEndtime(Date endtime) { this.endtime = endtime; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getTeacher() { return teacher; } public void setTeacher(String teacher) { this.teacher = teacher; } public String getStudent() { return student; } public void setStudent(String student) { this.student = student; } @Override public int hashCode() { int hash = 7; hash = 67 * hash + Objects.hashCode(this.id); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Appointment other = (Appointment) obj; if (!Objects.equals(this.id, other.id)) { return false; } return true; } }