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.IdClass; 024import javax.persistence.JoinColumn; 025import javax.persistence.JoinColumns; 026import javax.persistence.ManyToOne; 027import javax.persistence.Table; 028 029@IdClass(ParentWithMultipleFieldKeyId.class) 030@Entity 031@Table(name="KRTST_PARENT_WITH_MULTI_KEY_T") 032public class ParentWithMultipleFieldKey { 033 034 @Id 035 @Column(name="FIN_COA_CD",length=2) 036 String chartOfAccountsCode; 037 038 @Id 039 @Column(name="ACCOUNT_NBR",length=7) 040 String accountNumber; 041 042 @Column(name="ORG_CD",length=4) 043 String organizationCode; 044 045 @ManyToOne(fetch=FetchType.LAZY,cascade= {CascadeType.REFRESH}) 046 @JoinColumns( { 047 @JoinColumn(name="FIN_COA_CD",referencedColumnName="FIN_COA_CD",updatable=false,insertable=false) 048 , @JoinColumn(name="ORG_CD",referencedColumnName="ORG_CD",updatable=false,insertable=false) 049 } ) 050 TwoKeyChildObject organization; 051 052 public ParentWithMultipleFieldKey() {} 053 054 055 056 public ParentWithMultipleFieldKey(String chartOfAccountsCode, String accountNumber, String organizationCode) { 057 super(); 058 this.chartOfAccountsCode = chartOfAccountsCode; 059 this.accountNumber = accountNumber; 060 this.organizationCode = organizationCode; 061 } 062 063 064 065 public String getChartOfAccountsCode() { 066 return this.chartOfAccountsCode; 067 } 068 069 public void setChartOfAccountsCode(String chartOfAccountsCode) { 070 this.chartOfAccountsCode = chartOfAccountsCode; 071 } 072 073 public String getAccountNumber() { 074 return this.accountNumber; 075 } 076 077 public void setAccountNumber(String accountNumber) { 078 this.accountNumber = accountNumber; 079 } 080 081 public String getOrganizationCode() { 082 return this.organizationCode; 083 } 084 085 public void setOrganizationCode(String organizationCode) { 086 this.organizationCode = organizationCode; 087 } 088 089 public TwoKeyChildObject getOrganization() { 090 return this.organization; 091 } 092 093 public void setOrganization(TwoKeyChildObject organization) { 094 this.organization = organization; 095 } 096 097 @Override 098 public String toString() { 099 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}