View Javadoc
1   package ejava.examples.orm.core.mapped;
2   
3   /**
4    * This class provides an example of embedding another object within a 
5    * containing object being mapped to the database. In this case, XRay is
6    * assigned a primary key and mapped to the database. It has two local 
7    * properties, but maker name, address, and phone are part of a Manufacturer
8    * class. This works much like the embedded-id case, except the embedded class
9    * is just used for normal properties and not primary key values.
10   */
11  public class XRay {
12      private long id;
13      private Manufacturer maker;
14      private String model;
15      
16      public XRay() {}
17      public XRay(long id) { this.id = id; }
18      
19      public long getId() { return id; }
20  
21      public String getModel() { return model; }
22      public void setModel(String model) {
23          this.model = model;
24      }    
25  
26      public ejava.examples.orm.core.mapped.Manufacturer getMaker() { return maker; }
27      public void setMaker(ejava.examples.orm.core.mapped.Manufacturer maker) {
28          this.maker = maker;
29      }
30      
31      public String toString() {
32          return super.getClass().getName() +
33              ", id=" + id +
34              ", model=" + model +
35              ", maker=" + maker;
36      }
37  }