View Javadoc
1   package ejava.examples.orm.core.mapped;
2   
3   /**
4    * This class provides an example of joining three tables to make a single
5    * object. The WATCH, OWNER, and MAKER tables are joined by a common 
6    * primary key value. Of course, this requires a one-to-one mapping of 
7    * all 3 tables. If not, then we need to move to relationship mappings.
8    */
9   public class Watch {
10      private long id;
11      private String make;
12      private String model;
13      private String owner;
14      private String cardnum;
15      private String manufacturer;
16      private String address;
17      private String phone;
18  
19      public Watch() {}
20      public Watch(long id) { this.id = id; }
21      
22      public long getId() { return id; }
23  
24      public String getMake() { return make; }
25      public void setMake(String make) {
26          this.make = make;
27      }
28      public String getModel() { return model; }
29      public void setModel(String model) {
30          this.model = model;
31      }
32  
33      public String getOwner() { return owner; }
34      public void setOwner(String owner) {
35          this.owner = owner;
36      }
37  
38      public String getCardnum() { return cardnum; }
39      public void setCardnum(String cardnum) {
40          this.cardnum = cardnum;
41      }
42      
43      public String getManufacturer() { return manufacturer; }
44      public void setManufacturer(String manufacturer) {
45          this.manufacturer = manufacturer;
46      }
47  
48      public String getAddress() { return address; }
49      public void setAddress(String address) {
50          this.address = address;
51      }
52  
53      public String getPhone() { return phone; }
54      public void setPhone(String phone) {
55          this.phone = phone;
56      }
57  
58      public String toString() {
59          return super.toString() +
60              ", id=" + id +
61              ", make=" + make + 
62              ", model=" + model +
63              ", owner=" + owner +
64              ", cardnum=" + cardnum +
65              ", manufacturer=" + manufacturer +
66              ", address=" + address +
67              ", phone=" + phone;
68      }
69  }