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 javax.persistence.Entity;
19 import javax.persistence.GeneratedValue;
20 import javax.persistence.GenerationType;
21 import javax.persistence.Id;
22 import javax.persistence.NamedQueries;
23 import javax.persistence.NamedQuery;
24 import javax.persistence.OneToOne;
25 import javax.persistence.ManyToOne;
26
27
28
29
30
31
32
33
34 @Entity
35 @NamedQueries ({
36 @NamedQuery(name = "findCommitteeMember",
37 query = "SELECT c FROM CommitteeMemberEntity c WHERE " +
38 "c.positionName = :positionName " +
39 "AND c.assosiation = :assosiation"),
40 @NamedQuery(name = "findCommitteeMemberships",
41 query = "SELECT c FROM CommitteeMemberEntity c WHERE " +
42 "c.person = :person"),
43 @NamedQuery(name = "findAssociationsCommitteeMembers",
44 query = "SELECT c FROM CommitteeMemberEntity c WHERE " +
45 "c.assosiation.isoCountryCode = :countryCode " +
46 " AND c.assosiation.area = :area"),
47 @NamedQuery(name = "CommitteeMemberBasicSearch",
48 query = "SELECT c FROM CommitteeMemberEntity c WHERE " +
49 "c.positionName LIKE :search")
50 })
51 public class CommitteeMemberEntity {
52
53
54
55
56 @Id
57 @GeneratedValue(strategy=GenerationType.TABLE)
58 private long id;
59
60 private String positionName;
61
62 @OneToOne
63 private PersonEntity person;
64
65 @ManyToOne
66 private AssociationEntity assosiation;
67
68 public long getId() {
69 return id;
70 }
71
72 public void setId(long id) {
73 this.id = id;
74 }
75
76 public String getPositionName() {
77 return positionName;
78 }
79
80 public void setPositionName(String positionName) {
81 this.positionName = positionName;
82 }
83
84 public PersonEntity getPerson() {
85 return person;
86 }
87
88 public void setPerson(PersonEntity person) {
89 this.person = person;
90 }
91
92 public AssociationEntity getAssosiation() {
93 return assosiation;
94 }
95
96 public void setAssosiation(AssociationEntity assosiation) {
97 this.assosiation = assosiation;
98 }
99
100
101
102
103
104 public String toString(){
105 return this.positionName + " - " + this.assosiation.toString();
106 }
107 }