Rework.
1 package ru.indvdum.mywork.openjpa.model;
3 import javax.persistence.Column;
4 import javax.persistence.Entity;
5 import javax.persistence.GeneratedValue;
6 import javax.persistence.GenerationType;
7 import javax.persistence.Id;
8 import javax.persistence.Table;
16 @Table(name = "TASKS")
17 public class Task implements IDatabaseObject {
19 private static final long serialVersionUID = -4457948503094306717L;
23 @Column(name = "ID", nullable = false)
24 private Integer id = null;
26 @Column(name = "NAME")
27 private String name = null;
29 @Column(name = "DESCRIPTION")
30 private String description = null;
37 public boolean equals(Object obj) {
42 if (!(obj instanceof Task))
44 final Task other = (Task) obj;
45 return (getId() == other.getId() || (getId() != null && getId().equals(other.getId())));
49 public int hashCode() {
50 if(getId() != null && getId() != 0)
51 return getId().hashCode();
53 return super.hashCode();
57 public String toString() {
61 public Integer getId() {
65 public void setId(Integer id) {
69 public String getName() {
73 public void setName(String name) {
77 public String getDescription() {
81 public void setDescription(String description) {
82 this.description = description;