1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.in2.simpleBoard.model;
18
19 import java.io.Serializable;
20 import java.util.Date;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.NamedQueries;
27 import javax.persistence.Table;
28 import javax.persistence.Temporal;
29 import javax.persistence.TemporalType;
30
31 @Entity
32 @Table(name = "category")
33 @NamedQueries({})
34 public class Category implements Serializable {
35 private static final long serialVersionUID = 1L;
36 @Id
37 @Column(name = "id", nullable = false)
38 private Long id;
39 @Column(name = "name", nullable = false)
40 private String name;
41 @Column(name = "description", nullable = false)
42 private String description;
43 @Column(name = "date", nullable = false)
44 @Temporal(TemporalType.TIMESTAMP)
45 private Date date;
46
47 public Category() {
48 }
49
50 public Category(Long id) {
51 this.id = id;
52 }
53
54 public Category(Long id, String name, String description, Date date) {
55 this.id = id;
56 this.name = name;
57 this.description = description;
58 this.date = date;
59 }
60
61 @Id @GeneratedValue(strategy = GenerationType.AUTO)
62 public Long getId() {
63 return id;
64 }
65
66 public void setId(Long id) {
67 this.id = id;
68 }
69
70 public String getName() {
71 return name;
72 }
73
74 public void setName(String name) {
75 this.name = name;
76 }
77
78 public String getDescription() {
79 return description;
80 }
81
82 public void setDescription(String description) {
83 this.description = description;
84 }
85
86 public Date getDate() {
87 return date;
88 }
89
90 public void setDate(Date date) {
91 this.date = date;
92 }
93
94 @Override
95 public int hashCode() {
96 int hash = 0;
97 hash += (id != null ? id.hashCode() : 0);
98 return hash;
99 }
100
101 @Override
102 public boolean equals(Object object) {
103
104 if (!(object instanceof Category)) {
105 return false;
106 }
107 Category other = (Category) object;
108 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
109 return false;
110 }
111 return true;
112 }
113
114 @Override
115 public String toString() {
116 return "org.appfuse.tutorial.model.Category[id=" + id + "]";
117 }
118
119 }