1 5 package test.hibernate; 6 7 import java.io.Serializable ; 8 13 public class CompositeId implements Serializable 14 { 15 16 18 Integer _foo; 19 20 22 long _bar; 23 24 26 String _baz; 27 28 30 Order _order; 31 32 36 public Integer getFoo() 37 { 38 return _foo; 39 } 40 41 45 public long getBar() 46 { 47 return _bar; 48 } 49 50 54 public String getBaz() 55 { 56 return _baz; 57 } 58 59 63 public Order getOrder() 64 { 65 return _order; 66 } 67 68 71 public void setFoo(Integer foo) 72 { 73 _foo = foo; 74 } 75 76 79 public void setBar(long bar) 80 { 81 _bar = bar; 82 } 83 84 87 public void setBaz(String baz) 88 { 89 _baz = baz; 90 } 91 92 95 public void setOrder(Order order) 96 { 97 _order = order; 98 } 99 100 104 public boolean equals(Object o) 105 { 106 if (o == null) { 107 return false; 108 } 109 if (getClass().equals(o.getClass()) && 110 _foo.equals(((CompositeId) o).getFoo()) && 111 _bar == ((CompositeId) o).getBar() && 112 _baz.equals(((CompositeId) o).getBaz()) 113 ) { 114 return true; 115 } 116 else { 117 return false; 118 } 119 120 } 121 122 public int hashCode() 123 { 124 return _baz.hashCode(); 125 } 126 } 127 | Popular Tags |