View Javadoc
1   package ejava.examples.orm.core.mapped;
2   
3   /**
4    * This class an example of what to do with extra getter/setter fields
5    * (or fields) that should not be considered part of the persistence.
6    * The getMakeModel() convenience method will cause processing to fail 
7    * because there is no matching setter(). Marking it with Transient in
8    * the orm.xml file fixes this.
9    */
10  public class Tank {
11      private long id;
12      private String make;
13      private String model;
14      
15      public Tank() {}
16      public Tank(long id) { this.id = id; }
17      
18      public long getId() { return id; }
19      protected void setId(long id) {
20          this.id = id;
21      }
22  
23      public String getMakeModel() { return make + " " + model; }    
24  
25      public String getMake() { return make; }
26      public void setMake(String make) {
27          this.make = make;
28      }
29  
30      public String getModel() { return model; }
31      public void setModel(String model) {
32          this.model = model;
33      }
34  
35      public String toString() {
36          return super.toString() +
37             ", make=" + make +
38             ", model=" + model;
39      }
40  }