1 22 package org.jboss.ejb3.test.composite2; 23 24 import javax.persistence.Embeddable; 25 import java.io.Serializable ; 26 27 32 @Embeddable 33 public class CompositePK implements Serializable 34 { 35 private long id1; 36 private long id2; 37 38 public CompositePK() 39 { 40 } 41 42 public CompositePK(long id1, long id2) 43 { 44 this.id1 = id1; 45 this.id2 = id2; 46 } 47 48 public long getId1() 49 { 50 return id1; 51 } 52 53 public void setId1(long id1) 54 { 55 this.id1 = id1; 56 } 57 58 public long getId2() 59 { 60 return id2; 61 } 62 63 public void setId2(long id2) 64 { 65 this.id2 = id2; 66 } 67 68 public boolean equals(Object o) 69 { 70 if (this == o) return true; 71 if (!(o instanceof CompositePK)) return false; 72 73 final CompositePK compositePK = (CompositePK) o; 74 75 if (id1 != compositePK.id1) return false; 76 if (id2 != compositePK.id2) return false; 77 78 return true; 79 } 80 81 public int hashCode() 82 { 83 int result; 84 result = (int) (id1 ^ (id1 >>> 32)); 85 result = 29 * result + (int) (id2 ^ (id2 >>> 32)); 86 return result; 87 } 88 89 90 } 91 | Popular Tags |