1 package myorg.relex.collection;
2
3 import javax.persistence.*;
4
5
6
7
8
9 @Entity
10 @Table(name="RELATIONEX_POSITION")
11 public class Position {
12 @Id @GeneratedValue
13 private int id;
14
15 @Column(length=12, nullable=false)
16 private String position;
17
18 @Column(length=32, nullable=false, unique=true)
19 private String player;
20
21 protected Position() {}
22 public Position(String position, String player) {
23 this.position = position;
24 this.player = player;
25 }
26
27 public int getId() { return id; }
28
29 public String getPosition() { return position; }
30 public void setPosition(String position) { this.position = position; }
31
32 public String getPlayer() { return player; }
33 public void setPlayer(String player) {
34 this.player = player;
35 }
36
37 @Override
38 public int hashCode() {
39 return position==null?0:position.hashCode() + player==null?0:player.hashCode();
40 }
41
42 @Override
43 public boolean equals(Object obj) {
44 try {
45 if (this == obj) { return true; }
46 Position rhs = (Position) obj;
47 if (position==null || player==null) { return false; }
48 return position.equals(rhs.position) && player.equals(rhs.player);
49 } catch (Exception ex) { return false; }
50 }
51 }