KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hints > A


1 /*
2  * A.java
3  *
4  * Created on June 9, 2006, 9:50 AM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package hints;
11
12 import java.io.Serializable JavaDoc;
13 import javax.persistence.Entity;
14 import javax.persistence.GeneratedValue;
15 import javax.persistence.GenerationType;
16 import javax.persistence.Id;
17
18
19
20
21 /**
22  *
23  * @author jindra
24  */

25 @Entity
26 public class A implements Serializable JavaDoc {
27
28
29     @Id
30     @GeneratedValue(strategy = GenerationType.AUTO)
31     private Long JavaDoc id;
32     
33     /** Creates a new instance of A */
34     public A() {
35     }
36
37     public Long JavaDoc getId() {
38         return id;
39     }
40
41     public void setId(Long JavaDoc id) {
42         this.id = id;
43     }
44
45     public int hashCode() {
46         int hash = 0;
47         hash += (this.id != null ? this.id.hashCode() : 0);
48         return hash;
49     }
50
51     public boolean equals(Object JavaDoc object) {
52         // TODO: Warning - this method won't work in the case the id fields are not set
53
if (!(object instanceof A)) {
54             return false;
55         }
56         A other = (A)object;
57         if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
58         return true;
59     }
60
61     public String JavaDoc toString() {
62         return "hints.A[id=" + id + "]";
63     }
64     
65 }
66
Popular Tags