KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hints > B


1 /*
2  * B.java
3  *
4  * Created on June 9, 2006, 9:51 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 java.util.List JavaDoc;
14 import java.util.Queue JavaDoc;
15 import javax.persistence.Entity;
16 import javax.persistence.GeneratedValue;
17 import javax.persistence.GenerationType;
18 import javax.persistence.Id;
19
20
21
22 /**
23  *
24  * @author jindra
25  */

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