1 19 package org.netbeans.modules.exceptions.entity; 20 21 import java.io.Serializable ; 22 import javax.persistence.EmbeddedId; 23 import javax.persistence.Entity; 24 import javax.persistence.JoinColumn; 25 import javax.persistence.ManyToOne; 26 import javax.persistence.NamedQueries; 27 import javax.persistence.NamedQuery; 28 import javax.persistence.Table; 29 30 34 @Entity 35 @Table(name = "LINE") 36 @NamedQueries({@NamedQuery(name = "Line.findByStacktraceId", query = "SELECT l FROM Line l WHERE l.linePK.stacktraceId = :stacktraceId"), 37 @NamedQuery(name = "Line.findByMethodId", query = "SELECT l FROM Line l WHERE l.linePK.methodId = :methodId"), 38 @NamedQuery(name = "Line.findByLinenumber", query = "SELECT l FROM Line l WHERE l.linePK.linenumber = :linenumber"), 39 @NamedQuery(name = "Line.findByLineOrder", query = "SELECT l FROM Line l WHERE l.linePK.lineOrder = :lineOrder")}) 40 public class Line implements Serializable { 41 42 43 @EmbeddedId 44 protected LinePK linePK; 45 @JoinColumn(name = "METHOD_ID", referencedColumnName = "ID", insertable = false, updatable = false) 46 @ManyToOne 47 private Method method; 48 49 @JoinColumn(name = "STACKTRACE_ID", referencedColumnName = "ID", insertable = false, updatable = false) 50 @ManyToOne 51 private Stacktrace stacktrace; 52 53 54 public Line() { 55 } 56 57 public Line(LinePK linePK) { 58 this.linePK = linePK; 59 } 60 61 public Line(int stacktraceId, int methodId, int linenumber, int lineOrder) { 62 this.linePK = new LinePK(stacktraceId, methodId, linenumber, lineOrder); 63 } 64 65 public LinePK getLinePK() { 66 return linePK; 67 } 68 69 public void setLinePK(LinePK linePK) { 70 this.linePK = linePK; 71 } 72 73 public Method getMethod() { 74 return method; 75 } 76 77 public void setMethod(Method method) { 78 this.method = method; 79 } 80 81 82 public Stacktrace getStacktrace() { 83 return stacktrace; 84 } 85 86 public void setStacktrace(Stacktrace stacktrace) { 87 this.stacktrace = stacktrace; 88 } 89 90 @Override 91 public int hashCode() { 92 int hash = 0; 93 94 hash += (linePK != null ? linePK.hashCode() 95 : 0); 96 return hash; 97 } 98 99 @Override 100 public boolean equals(Object object) { 101 if (!(object instanceof Line)) { 102 return false; 103 } 104 Line other = (Line) object; 105 106 if (this.linePK != other.linePK && 107 (this.linePK == null || !this.linePK.equals(other.linePK))) 108 return false; 109 return true; 110 } 111 112 @Override 113 public String toString() { 114 return "test.Line[linePK=" + linePK + "]"; 115 } 116 117 } 118 | Popular Tags |