1 package myorg.relex.one2manybi;
2
3 import java.io.Serializable;
4
5
6
7
8
9
10 public class TirePK implements Serializable {
11 private static final long serialVersionUID = -6028270454708159105L;
12 private int car;
13 private TirePosition position;
14
15 protected TirePK() {}
16 public TirePK(int carId, TirePosition position) {
17 this.car=carId;
18 this.position=position;
19 }
20
21 public int getAutoId() { return car; }
22 public TirePosition getPosition() { return position; }
23
24 @Override
25 public int hashCode() {
26 return car + (position==null?0:position.hashCode());
27 }
28
29 @Override
30 public boolean equals(Object obj) {
31 try {
32 if (this==obj) { return true; }
33 TirePK rhs = (TirePK)obj;
34 return car==rhs.car && position==rhs.position;
35 } catch (Exception ex) { return false; }
36 }
37 }