View Javadoc

1   /**
2   Copyright (C) 2007  <name of author>
3   
4   This program is free software: you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation, either version 3 of the License, or
7   (at your option) any later version.
8   
9   This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  GNU General Public License for more details.
13  
14  You should have received a copy of the GNU General Public License
15  along with this program.  If not, see <http://www.gnu.org/licenses/>.
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         // TODO: Warning - this method won't work in the case the id fields are not set
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 }