KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > manytoone > NodePk


1 //$Id: NodePk.java,v 1.1 2005/05/12 13:33:33 epbernard Exp $
2
package org.hibernate.test.annotations.manytoone;
3
4 import javax.persistence.Column;
5 import javax.persistence.Embeddable;
6 import java.io.Serializable JavaDoc;
7
8 /**
9  * @author Emmanuel Bernard
10  */

11 @Embeddable
12 public class NodePk implements Serializable JavaDoc {
13     private String JavaDoc name;
14     private int level;
15
16     public boolean equals(Object JavaDoc o) {
17         if (this == o) return true;
18         if (!(o instanceof NodePk)) return false;
19
20         final NodePk nodePk = (NodePk) o;
21
22         if (level != nodePk.level) return false;
23         if (!name.equals(nodePk.name)) return false;
24
25         return true;
26     }
27
28     public int hashCode() {
29         int result;
30         result = name.hashCode();
31         result = 29 * result + level;
32         return result;
33     }
34
35     public String JavaDoc getName() {
36         return name;
37     }
38
39     public void setName(String JavaDoc name) {
40         this.name = name;
41     }
42
43     @Column(name="fld_lvl")
44     public int getLevel() {
45         return level;
46     }
47
48     public void setLevel(int level) {
49         this.level = level;
50     }
51 }
52
Popular Tags