1 19 package org.netbeans.modules.exceptions.entity; 20 21 import java.io.Serializable ; 22 import javax.persistence.Column; 23 import javax.persistence.EmbeddedId; 24 import javax.persistence.Entity; 25 import javax.persistence.JoinColumn; 26 import javax.persistence.ManyToOne; 27 import javax.persistence.NamedQueries; 28 import javax.persistence.NamedQuery; 29 import javax.persistence.Table; 30 31 35 @Entity 36 @Table(name = "COMMENT") 37 @NamedQueries({@NamedQuery(name = "Comment.findById", query = "SELECT c FROM Comment c WHERE c.commentPK.id = :id"), 38 @NamedQuery(name = "Comment.findByIssueId", query = "SELECT c FROM Comment c WHERE c.commentPK.issueId = :issueId"), 39 @NamedQuery(name = "Comment.findByComment", query = "SELECT c FROM Comment c WHERE c.comment = :comment"), 40 @NamedQuery(name = "Comment.findByLoggername", query = "SELECT c FROM Comment c WHERE c.loggername = :loggername")}) 41 public class Comment implements Serializable { 42 43 44 @EmbeddedId 45 protected CommentPK commentPK; 46 @Column(name = "COMMENT") 47 private String comment; 48 @Column(name = "LOGGERNAME") 49 private String loggername; 50 @JoinColumn(name = "ISSUE_ID", referencedColumnName = "ID", insertable = false, updatable = false) 51 @ManyToOne 52 private Issue issue; 53 @JoinColumn(name = "NBUSER_ID", referencedColumnName = "ID") 54 @ManyToOne 55 private Nbuser nbuserId; 56 57 58 public Comment() { 59 } 60 61 public Comment(CommentPK commentPK) { 62 this.commentPK = commentPK; 63 } 64 65 public Comment(int id, int issueId) { 66 this.commentPK = new CommentPK(id, issueId); 67 } 68 69 public CommentPK getCommentPK() { 70 return commentPK; 71 } 72 73 public void setCommentPK(CommentPK commentPK) { 74 this.commentPK = commentPK; 75 } 76 77 public String getComment() { 78 return comment; 79 } 80 81 public void setComment(String comment) { 82 this.comment = comment; 83 } 84 85 public String getLoggername() { 86 return loggername; 87 } 88 89 public void setLoggername(String loggername) { 90 this.loggername = loggername; 91 } 92 93 public Issue getIssue() { 94 return issue; 95 } 96 97 public void setIssue(Issue issue) { 98 this.issue = issue; 99 } 100 101 public Nbuser getNbuserId() { 102 return nbuserId; 103 } 104 105 public void setNbuserId(Nbuser nbuserId) { 106 this.nbuserId = nbuserId; 107 } 108 109 @Override 110 public int hashCode() { 111 int hash = 0; 112 113 hash += (commentPK != null ? commentPK.hashCode() 114 : 0); 115 return hash; 116 } 117 118 @Override 119 public boolean equals(Object object) { 120 if (!(object instanceof Comment)) { 121 return false; 122 } 123 Comment other = (Comment) object; 124 125 if (this.commentPK != other.commentPK && 126 (this.commentPK == null || !this.commentPK.equals(other.commentPK))) 127 return false; 128 return true; 129 } 130 131 @Override 132 public String toString() { 133 return "test.Comment[commentPK=" + commentPK + "]"; 134 } 135 136 } 137 | Popular Tags |