| | |
| | | package de.gedoplan.seminar.jpa.exercise.domain; |
| | | |
| | | public class Junction { |
| | | import java.util.Objects; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Table; |
| | | |
| | | @Entity |
| | | @Table(name = Junction.TABLE_NAME) |
| | | public class Junction { |
| | | |
| | | public static final String TABLE_NAME = "JPA_JUNCTION"; |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | private JunctionKind kind; |
| | | |
| | | private String no; |
| | | |
| | | public Junction() { |
| | | |
| | | } |
| | | |
| | | public Junction(String name, JunctionKind kind, String no) { |
| | | this.name = name; |
| | |
| | | this.no = no; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public JunctionKind getKind() { |
| | | return kind; |
| | | } |
| | | |
| | | public void setKind(JunctionKind kind) { |
| | | this.kind = kind; |
| | | } |
| | | |
| | | public String getNo() { |
| | | return no; |
| | | } |
| | | |
| | | public void setNo(String no) { |
| | | this.no = no; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | return Objects.hash(id); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) |
| | | return true; |
| | | if (obj == null) |
| | | return false; |
| | | if (getClass() != obj.getClass()) |
| | | return false; |
| | | Junction other = (Junction) obj; |
| | | return Objects.equals(id, other.id); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Junction [id=" + id + ", name=" + name + ", kind=" + kind + ", no=" + no + "]"; |
| | | } |
| | | |
| | | } |