View Javadoc
1   /*
2    * Copyright 2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
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 org.kuali.rice.krad.test.document.bo;
17  
18  import javax.persistence.CascadeType;
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.FetchType;
22  import javax.persistence.Id;
23  import javax.persistence.JoinColumn;
24  import javax.persistence.OneToOne;
25  import javax.persistence.Table;
26  
27  @Entity
28  @Table(name="KRTST_PARENT_OF_UPDATABLE_T")
29  public class ParentObjectWithUpdatableChild {
30  
31      @Id
32      @Column(name="PK_COL",length=8,precision=0)
33      Long primaryKey;
34  
35      @Column(name="UPDATABLE_CHILD_KEY_COL",length=10)
36      String updatableChildsKey;
37  
38      @OneToOne(fetch=FetchType.EAGER,cascade= {CascadeType.ALL},orphanRemoval=true)
39      @JoinColumn(name="UPDATABLE_CHILD_KEY_COL",referencedColumnName="PK_COL",updatable=false,insertable=false)
40      UpdatableChildObject updatableChild;
41  
42      public Long getPrimaryKey() {
43          return this.primaryKey;
44      }
45  
46      public void setPrimaryKey(Long primaryKey) {
47          this.primaryKey = primaryKey;
48      }
49  
50      public String getUpdatableChildsKey() {
51          return this.updatableChildsKey;
52      }
53  
54      public void setUpdatableChildsKey(String updatableChildsKey) {
55          this.updatableChildsKey = updatableChildsKey;
56      }
57  
58      public UpdatableChildObject getUpdatableChild() {
59          return this.updatableChild;
60      }
61  
62      public void setUpdatableChild(UpdatableChildObject updatableChild) {
63          this.updatableChild = updatableChild;
64      }
65  
66      @Override
67      public String toString() {
68          StringBuilder builder = new StringBuilder();
69          builder.append("ParentObjectWithUpdatableChild [");
70          if (this.primaryKey != null) {
71              builder.append("primaryKey=").append(this.primaryKey).append(", ");
72          }
73          if (this.updatableChildsKey != null) {
74              builder.append("updatableChildsKey=").append(this.updatableChildsKey).append(", ");
75          }
76          if (this.updatableChild != null) {
77              builder.append("updatableChild=").append(this.updatableChild);
78          }
79          builder.append("]");
80          return builder.toString();
81      }
82  
83  
84  
85  }