001/* 002 * Copyright 2011 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl1.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.test.document.bo; 017 018import javax.persistence.CascadeType; 019import javax.persistence.Column; 020import javax.persistence.Entity; 021import javax.persistence.FetchType; 022import javax.persistence.Id; 023import javax.persistence.JoinColumn; 024import javax.persistence.OneToOne; 025import javax.persistence.Table; 026 027@Entity 028@Table(name="KRTST_PARENT_OF_UPDATABLE_T") 029public class ParentObjectWithUpdatableChild { 030 031 @Id 032 @Column(name="PK_COL",length=8,precision=0) 033 Long primaryKey; 034 035 @Column(name="UPDATABLE_CHILD_KEY_COL",length=10) 036 String updatableChildsKey; 037 038 @OneToOne(fetch=FetchType.EAGER,cascade= {CascadeType.ALL},orphanRemoval=true) 039 @JoinColumn(name="UPDATABLE_CHILD_KEY_COL",referencedColumnName="PK_COL",updatable=false,insertable=false) 040 UpdatableChildObject updatableChild; 041 042 public Long getPrimaryKey() { 043 return this.primaryKey; 044 } 045 046 public void setPrimaryKey(Long primaryKey) { 047 this.primaryKey = primaryKey; 048 } 049 050 public String getUpdatableChildsKey() { 051 return this.updatableChildsKey; 052 } 053 054 public void setUpdatableChildsKey(String updatableChildsKey) { 055 this.updatableChildsKey = updatableChildsKey; 056 } 057 058 public UpdatableChildObject getUpdatableChild() { 059 return this.updatableChild; 060 } 061 062 public void setUpdatableChild(UpdatableChildObject updatableChild) { 063 this.updatableChild = updatableChild; 064 } 065 066 @Override 067 public String toString() { 068 StringBuilder builder = new StringBuilder(); 069 builder.append("ParentObjectWithUpdatableChild ["); 070 if (this.primaryKey != null) { 071 builder.append("primaryKey=").append(this.primaryKey).append(", "); 072 } 073 if (this.updatableChildsKey != null) { 074 builder.append("updatableChildsKey=").append(this.updatableChildsKey).append(", "); 075 } 076 if (this.updatableChild != null) { 077 builder.append("updatableChild=").append(this.updatableChild); 078 } 079 builder.append("]"); 080 return builder.toString(); 081 } 082 083 084 085}