1 19 package org.netbeans.modules.exceptions.entity; 20 21 import java.io.Serializable ; 22 import java.util.Collection ; 23 import javax.persistence.CascadeType; 24 import javax.persistence.Column; 25 import javax.persistence.Entity; 26 import javax.persistence.Id; 27 import javax.persistence.JoinColumn; 28 import javax.persistence.ManyToOne; 29 import javax.persistence.NamedQueries; 30 import javax.persistence.NamedQuery; 31 import javax.persistence.OneToMany; 32 import javax.persistence.OneToOne; 33 import javax.persistence.Table; 34 35 39 @Entity 40 @Table(name = "STACKTRACE") 41 @NamedQueries({@NamedQuery(name = "Stacktrace.findById", query = "SELECT s FROM Stacktrace s WHERE s.id = :id"), 42 @NamedQuery(name = "Stacktrace.findByMessage", query = "SELECT s FROM Stacktrace s WHERE s.message = :message"), 43 @NamedQuery(name = "Stacktrace.findByClass1", query = "SELECT s FROM Stacktrace s WHERE s.class1 = :class1")}) 44 public class Stacktrace implements Serializable { 45 46 47 @Id 48 @Column(name = "ID", nullable = false) 49 private Integer id; 50 @Column(name = "MESSAGE") 51 private String message; 52 @Column(name = "CLASS") 53 private String class1; 54 @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false) 55 @OneToOne 56 private Issue issue; 57 @OneToMany(mappedBy = "annotation") 58 private Collection <Stacktrace> stacktraceCollection; 59 @JoinColumn(name = "ANNOTATION", referencedColumnName = "ID") 60 @ManyToOne 61 private Stacktrace annotation; 62 @OneToMany(cascade = CascadeType.ALL, mappedBy = "stacktrace") 63 private Collection <Line> lineCollection; 64 65 66 public Stacktrace() { 67 } 68 69 public Stacktrace(Integer id) { 70 this.id = id; 71 } 72 73 public Integer getId() { 74 return id; 75 } 76 77 public void setId(Integer id) { 78 this.id = id; 79 } 80 81 public String getMessage() { 82 return message; 83 } 84 85 public void setMessage(String message) { 86 this.message = message; 87 } 88 89 public String getClass1() { 90 return class1; 91 } 92 93 public void setClass1(String class1) { 94 this.class1 = class1; 95 } 96 97 public Issue getIssue() { 98 return issue; 99 } 100 101 public void setIssue(Issue issue) { 102 this.issue = issue; 103 } 104 105 public Collection <Stacktrace> getStacktraceCollection() { 106 return stacktraceCollection; 107 } 108 109 public void setStacktraceCollection(Collection <Stacktrace> stacktraceCollection) { 110 this.stacktraceCollection = stacktraceCollection; 111 } 112 113 public Stacktrace getAnnotation() { 114 return annotation; 115 } 116 117 public void setAnnotation(Stacktrace annotation) { 118 this.annotation = annotation; 119 } 120 121 public Collection <Line> getLineCollection() { 122 return lineCollection; 123 } 124 125 public void setLineCollection(Collection <Line> lineCollection) { 126 this.lineCollection = lineCollection; 127 } 128 129 @Override 130 public int hashCode() { 131 int hash = 0; 132 133 hash += (id != null ? id.hashCode() 134 : 0); 135 return hash; 136 } 137 138 @Override 139 public boolean equals(Object object) { 140 if (!(object instanceof Stacktrace)) { 141 return false; 142 } 143 Stacktrace other = (Stacktrace) object; 144 145 if (this.id != other.id && 146 (this.id == null || !this.id.equals(other.id))) 147 return false; 148 return true; 149 } 150 151 @Override 152 public String toString() { 153 return "test.Stacktrace[id=" + id + "]"; 154 } 155 156 } 157 | Popular Tags |