View Javadoc

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  import javax.persistence.ManyToOne;
26  
27  /**
28   * An persistence entity description. There is no logic just getter and setters,
29   * for the properties. This Object represents a table in the database and the
30   * properties are fields.
31   *
32   * @author dougculnane
33   */
34  @Entity
35  @NamedQueries( {
36      @NamedQuery(name = "findEquipmentSupplierByName",
37              query = "SELECT e FROM EquipmentSupplierEntity e WHERE e.name = :name"),
38      @NamedQuery(name = "EquipmentSupplierBasicSearch",
39              query = "SELECT o FROM EquipmentSupplierEntity o WHERE o.name LIKE :search") 
40  })
41  public class EquipmentSupplierEntity {
42  
43      /**
44       * Object Identifier.
45       */
46      @Id
47      @GeneratedValue(strategy=GenerationType.TABLE)
48      private long id;
49  
50      private String name = "";
51  
52      @OneToOne
53      private AddressEntity address;
54  
55      private String url = "";
56  
57      public AddressEntity getAddress() {
58          return address;
59      }
60  
61      @ManyToOne
62      private PersonEntity people;
63  
64      public void setAddress(AddressEntity address) {
65          this.address = address;
66      }
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 getName() {
77          return name;
78      }
79  
80      public void setName(String name) {
81          this.name = name;
82      }
83  
84      public String getUrl() {
85          return url;
86      }
87  
88      public void setUrl(String url) {
89          this.url = url;
90      }
91  
92      public PersonEntity getPeople() {
93          return people;
94      }
95  
96      public void setPeople(PersonEntity people) {
97          this.people = people;
98      }
99  
100     /**
101      * Override the Object method to give a usable human readable 
102      * representation of the Object.
103      */
104     public String toString(){
105         return name;
106     }
107 }