View Javadoc
1   package ejava.examples.orm.map.annotated;
2   
3   
4   import javax.persistence.*;
5   
6   /**
7    * This class represents the child in a One-to_Many, uni-directional and
8    * bi-directional relationship. The child owns the relationship in both cases.
9    */
10  @Entity @Table(name="ORMMAP_ONEMANY_OWNCHILD")
11  public class OneManyOwningChild {
12      @Id
13      private String name;
14      @ManyToOne
15      private OneManyInverseParent oneInverseParent; 	
16      
17      protected OneManyOwningChild() {}
18      public OneManyOwningChild(String name) { this.name = name; }
19  
20      public String getName() { return name; }
21  
22      public OneManyInverseParent getOneInverseParent() { return oneInverseParent; }
23      public void setOneInverseParent(OneManyInverseParent oneInverseParent) {
24              this.oneInverseParent = oneInverseParent;
25      }
26      
27      public String toString() {
28          StringBuilder text = new StringBuilder();
29          text.append(getClass().getName());
30          text.append(", name=" + name);
31          if (oneInverseParent != null) {
32                  text.append(", oneInverseParent={" + oneInverseParent + "}");
33          }
34          return text.toString();
35      }
36  }