1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.imca.model.entities;
17
18 import java.util.Collection;
19
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.GenerationType;
23 import javax.persistence.Id;
24 import javax.persistence.ManyToMany;
25 import javax.persistence.NamedQueries;
26 import javax.persistence.NamedQuery;
27
28
29
30
31
32
33
34
35 @Entity
36 @NamedQueries( {
37 @NamedQuery(name = "findSailNumberBySailNumber",
38 query = "SELECT s FROM SailNumberEntity s WHERE " +
39 "s.sailNumber = :sailNumber"),
40 @NamedQuery(name = "SailNumberBasicSearch",
41 query="SELECT s FROM SailNumberEntity s WHERE " +
42 "s.sailNumber = :search")
43 })
44 public class SailNumberEntity {
45
46
47
48
49 @Id
50 @GeneratedValue(strategy=GenerationType.TABLE)
51 private long id;
52
53 private String sailNumber = "";
54
55 @ManyToMany
56 private Collection<BoatEntity> boats;
57
58 public long getId() {
59 return id;
60 }
61
62 public void setId(long id) {
63 this.id = id;
64 }
65
66 public String getSailNumber() {
67 return sailNumber;
68 }
69
70 public void setSailNumber(String sailNumber) {
71 this.sailNumber = sailNumber;
72 }
73
74 public Collection<BoatEntity> getBoats() {
75 return boats;
76 }
77
78 public void setBoats(Collection<BoatEntity> boats) {
79 this.boats = boats;
80 }
81
82
83
84
85
86 public String toString(){
87 return sailNumber;
88 }
89 }