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.IdClass;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.JoinColumns;
26  import javax.persistence.ManyToOne;
27  import javax.persistence.Table;
28  
29  @IdClass(ParentWithMultipleFieldKeyId.class)
30  @Entity
31  @Table(name="KRTST_PARENT_WITH_MULTI_KEY_T")
32  public class ParentWithMultipleFieldKey {
33  
34      @Id
35      @Column(name="FIN_COA_CD",length=2)
36      String chartOfAccountsCode;
37  
38      @Id
39      @Column(name="ACCOUNT_NBR",length=7)
40      String accountNumber;
41  
42      @Column(name="ORG_CD",length=4)
43      String organizationCode;
44  
45      @ManyToOne(fetch=FetchType.LAZY,cascade= {CascadeType.REFRESH})
46      @JoinColumns( {
47                @JoinColumn(name="FIN_COA_CD",referencedColumnName="FIN_COA_CD",updatable=false,insertable=false)
48              , @JoinColumn(name="ORG_CD",referencedColumnName="ORG_CD",updatable=false,insertable=false)
49      } )
50      TwoKeyChildObject organization;
51  
52      public ParentWithMultipleFieldKey() {}
53  
54  
55  
56      public ParentWithMultipleFieldKey(String chartOfAccountsCode, String accountNumber, String organizationCode) {
57          super();
58          this.chartOfAccountsCode = chartOfAccountsCode;
59          this.accountNumber = accountNumber;
60          this.organizationCode = organizationCode;
61      }
62  
63  
64  
65      public String getChartOfAccountsCode() {
66          return this.chartOfAccountsCode;
67      }
68  
69      public void setChartOfAccountsCode(String chartOfAccountsCode) {
70          this.chartOfAccountsCode = chartOfAccountsCode;
71      }
72  
73      public String getAccountNumber() {
74          return this.accountNumber;
75      }
76  
77      public void setAccountNumber(String accountNumber) {
78          this.accountNumber = accountNumber;
79      }
80  
81      public String getOrganizationCode() {
82          return this.organizationCode;
83      }
84  
85      public void setOrganizationCode(String organizationCode) {
86          this.organizationCode = organizationCode;
87      }
88  
89      public TwoKeyChildObject getOrganization() {
90          return this.organization;
91      }
92  
93      public void setOrganization(TwoKeyChildObject organization) {
94          this.organization = organization;
95      }
96  
97      @Override
98      public String toString() {
99          StringBuilder builder = new StringBuilder();
100         builder.append("ParentWithMultipleFieldKey [chartOfAccountsCode=").append(this.chartOfAccountsCode)
101                 .append(", accountNumber=").append(this.accountNumber).append(", organizationCode=")
102                 .append(this.organizationCode).append(", organization=").append(this.organization).append("]");
103         return builder.toString();
104     }
105 
106 
107 }