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  
25  /**
26   * An persistence entity description. There is no logic just getter and setters,
27   * for the properties. This Object represents a table in the database and the
28   * properties are fields.
29   *
30   * @author dougculnane
31   */
32  @Entity
33  @NamedQueries( {
34      @NamedQuery(name = "FeeBasicSearch",
35              query = "SELECT o FROM FeeEntity o WHERE o.currency LIKE :search") 
36  })
37  public class FeeEntity {
38  
39      /**
40       * Object Identifier.
41       */
42      @Id
43      @GeneratedValue(strategy=GenerationType.TABLE)
44      private long id;
45  
46      private double amount;
47  
48      private String currency = "";
49  
50      public double getAmount() {
51          return amount;
52      }
53  
54      public void setAmount(double amount) {
55          this.amount = amount;
56      }
57  
58      public String getCurrency() {
59          return currency;
60      }
61  
62      public void setCurrency(String currency) {
63          this.currency = currency;
64      }
65  
66      public long getId() {
67          return id;
68      }
69  
70      public void setId(long id) {
71          this.id = id;
72      }
73  
74      /**
75       * Override the Object method to give a usable human readable 
76       * representation of the Object.
77       */
78      public String toString(){
79          return this.currency + " " + amount;
80      }
81  }