1 /*
2 * Copyright 2007 The International Moth Class Association (IMCA)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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
26 /**
27 * An persistence entity description. There is no logic just getter and setters,
28 * for the properties. This Object represents a table in the database and the
29 * properties are fields.
30 *
31 * @author dougculnane
32 */
33 @Entity
34 @NamedQueries( {
35 @NamedQuery(name = "SailingClubBasicSearch",
36 query="SELECT o FROM SailingClubEntity o WHERE " +
37 "o.name = :search")
38 })
39 public class SailingClubEntity {
40
41 /**
42 * Object Identifier.
43 */
44 @Id
45 @GeneratedValue(strategy=GenerationType.TABLE)
46 private long id;
47
48 private String name = "";
49
50 @OneToOne
51 private AddressEntity address;
52
53 private String url = "";
54
55 public AddressEntity getAddress() {
56 return address;
57 }
58
59 public void setAddress(AddressEntity address) {
60 this.address = address;
61 }
62
63 public long getId() {
64 return id;
65 }
66
67 public void setId(long id) {
68 this.id = id;
69 }
70
71 public String getName() {
72 return name;
73 }
74
75 public void setName(String name) {
76 this.name = name;
77 }
78
79 public String getUrl() {
80 return url;
81 }
82
83 public void setUrl(String url) {
84 this.url = url;
85 }
86
87 /**
88 * Override the Object method to give a usable human readable
89 * representation of the Object.
90 */
91 public String toString(){
92 return name;
93 }
94 }