1 19 package org.netbeans.modules.exceptions.entity; 20 21 import java.io.Serializable ; 22 import java.util.Collection ; 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 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 { 40 41 42 @Id 43 @Column(name = "ID", nullable = false) 44 private Integer id; 45 @Column(name = "NAME") 46 private String name; 47 @OneToMany(mappedBy = "nbuserId") 48 private Collection <Comment> commentCollection; 49 50 51 public Nbuser() { 52 } 53 54 public Nbuser(Integer id) { 55 this.id = id; 56 } 57 58 public Integer getId() { 59 return id; 60 } 61 62 public void setId(Integer id) { 63 this.id = id; 64 } 65 66 public String getName() { 67 return name; 68 } 69 70 public void setName(String name) { 71 this.name = name; 72 } 73 74 public Collection <Comment> getCommentCollection() { 75 return commentCollection; 76 } 77 78 public void setCommentCollection(Collection <Comment> commentCollection) { 79 this.commentCollection = commentCollection; 80 } 81 82 @Override 83 public int hashCode() { 84 int hash = 0; 85 86 hash += (id != null ? id.hashCode() 87 : 0); 88 return hash; 89 } 90 91 @Override 92 public boolean equals(Object 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 105 public String toString() { 106 return "test.Nbuser[id=" + id + "]"; 107 } 108 109 } 110 | Popular Tags |