KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > exceptions > entity > CommentPK


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.exceptions.entity;
20
21 import java.io.Serializable JavaDoc;
22 import javax.persistence.Column;
23 import javax.persistence.Embeddable;
24
25 /**
26  *
27  * @author Jan Horvath
28  */

29 @Embeddable
30 public class CommentPK implements Serializable JavaDoc {
31     
32     /** Creates a new instance of CommentPK */
33         @Column(name = "ID", nullable = false)
34     private int id;
35     @Column(name = "ISSUE_ID", nullable = false)
36     private int issueId;
37
38     /** Creates a new instance of CommentPK */
39     public CommentPK() {
40     }
41     
42     public CommentPK(int id, int issueId) {
43         this.id = id;
44         this.issueId = issueId;
45     }
46
47     public int getId() {
48         return id;
49     }
50
51     public void setId(int id) {
52         this.id = id;
53     }
54
55     public int getIssueId() {
56         return issueId;
57     }
58
59     public void setIssueId(int issueId) {
60         this.issueId = issueId;
61     }
62
63     @Override JavaDoc
64     public int hashCode() {
65         int hash = 0;
66
67         hash += (int) id;
68         hash += (int) issueId;
69         return hash;
70     }
71
72     @Override JavaDoc
73     public boolean equals(Object JavaDoc object) {
74         if (!(object instanceof CommentPK)) {
75             return false;
76         }
77         CommentPK other = (CommentPK) object;
78
79         if (this.id != other.id)
80             return false;
81         if (this.issueId != other.issueId)
82             return false;
83         return true;
84     }
85
86     @Override JavaDoc
87     public String JavaDoc toString() {
88         return "test.CommentPK[id=" + id + ", issueId=" + issueId + "]";
89     }
90
91 }
92
Popular Tags