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.dental.model; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonManagedReference; import java.io.Serializable; import java.util.List; import java.util.Objects; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.validator.constraints.NotBlank; import th.co.geniustree.dental.validator.DepartmentNameUnique; /** * * @author Best */ @Entity @Table(name = "DEPARTMENT") public class Department implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; // @DepartmentNameUnique @Column(name = "NAME", nullable = false) @NotBlank(message = "????") private String name; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public int hashCode() { int hash = 3; hash = 71 * 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 Department other = (Department) obj; if (!Objects.equals(this.id, other.id)) { return false; } return true; } }