KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Collection JavaDoc;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.Id;
26 import javax.persistence.NamedQueries;
27 import javax.persistence.NamedQuery;
28 import javax.persistence.OneToMany;
29 import javax.persistence.Table;
30
31 /**
32  *
33  * @author Jan Horvath
34  */

35 @Entity
36 @Table(name = "NBUSER")
37 @NamedQueries({@NamedQuery(name = "Nbuser.findById", query = "SELECT n FROM Nbuser n WHERE n.id = :id"),
38         @NamedQuery(name = "Nbuser.findByName", query = "SELECT n FROM Nbuser n WHERE n.name = :name")})
39 public class Nbuser implements Serializable JavaDoc {
40     
41     /** Creates a new instance of Nbuser */
42         @Id
43     @Column(name = "ID", nullable = false)
44     private Integer JavaDoc id;
45     @Column(name = "NAME")
46     private String JavaDoc name;
47     @OneToMany(mappedBy = "nbuserId")
48     private Collection JavaDoc<Comment> commentCollection;
49
50     /** Creates a new instance of Nbuser */
51     public Nbuser() {
52     }
53     
54     public Nbuser(Integer JavaDoc id) {
55         this.id = id;
56     }
57
58     public Integer JavaDoc getId() {
59         return id;
60     }
61
62     public void setId(Integer JavaDoc id) {
63         this.id = id;
64     }
65
66     public String JavaDoc getName() {
67         return name;
68     }
69
70     public void setName(String JavaDoc name) {
71         this.name = name;
72     }
73
74     public Collection JavaDoc<Comment> getCommentCollection() {
75         return commentCollection;
76     }
77
78     public void setCommentCollection(Collection JavaDoc<Comment> commentCollection) {
79         this.commentCollection = commentCollection;
80     }
81
82     @Override JavaDoc
83     public int hashCode() {
84         int hash = 0;
85
86         hash += (id != null ? id.hashCode()
87                             : 0);
88         return hash;
89     }
90
91     @Override JavaDoc
92     public boolean equals(Object JavaDoc object) {
93         if (!(object instanceof Nbuser)) {
94             return false;
95         }
96         Nbuser other = (Nbuser) object;
97
98         if (this.id != other.id &&
99             (this.id == null || !this.id.equals(other.id)))
100             return false;
101         return true;
102     }
103
104     @Override JavaDoc
105     public String JavaDoc toString() {
106         return "test.Nbuser[id=" + id + "]";
107     }
108
109 }
110
Popular Tags