2015-12-14 28 views
-1

我跑我的测试代码,但显示从控制台 ==========Start========== Exception in thread "main" java.lang.NullPointerException at practice.BeanUtilsCopyPropertiesTest.main(BeanUtilsCopyPropertiesTest.java:16)螺纹JAVA BeanUtils.copyProperties异常“主”

如果我使用 Ch409FId fromBean = new Ch409FId(); fromBean.setxxx

它的工作!

,但我不知道为什么我不能用 Ch409F fromBean = new Ch409F(); fromBean.getId().setxxxx

非常感谢......

我这样的代码:

主要 这是我的主要代码

package practice; 

import java.lang.reflect.InvocationTargetException; 

import org.apache.commons.beanutils.BeanUtils; 
import org.apache.commons.lang.builder.ToStringBuilder; 

import bean.Ch409DifF; 
import bean.Ch409F; 

public class BeanUtilsCopyPropertiesTest { 

    public static void main(String[] args) { 
     System.out.println("==========Start=========="); 
     Ch409F fromBean = new Ch409F(); 
     fromBean.getId().setCardClass("fromBean:CardClass"); 
     fromBean.getId().setCardNo("fromBean:CardNo"); 
     fromBean.getId().setRegId("fromBean:RegId"); 
     fromBean.getId().setSeqNo("fromBean:SeqNo"); 
     fromBean.getId().setStoreNo("fromBean:StoreNo"); 
     fromBean.getId().setTaskId("fromBean:TaskId"); 
     fromBean.getId().setTransDate("fromBean:TransDate"); 
     fromBean.getId().setTransTime("fromBean:TransTime"); 
     fromBean.getId().setTransType("fromBean:TransType"); 

     Ch409DifF toBean = new Ch409DifF(); 
     toBean.getId().setCardClass("toBean:CardClass"); 
     toBean.getId().setCardNo("toBean:CardNo"); 
     toBean.getId().setRegId("toBean:RegId"); 
     toBean.getId().setSeqNo("toBean:SeqNo"); 
     toBean.getId().setStoreNo("toBean:StoreNo"); 
     toBean.getId().setTaskId("toBean:TaskId"); 
     toBean.getId().setTransDate("toBean:TransDate"); 
     toBean.getId().setTransTime("toBean:TransTime"); 
     toBean.getId().setTransType("toBean:Transtype"); 

     System.out.println(ToStringBuilder.reflectionToString(fromBean.getId())); 
     System.out.println(ToStringBuilder.reflectionToString(toBean.getId())); 
     try { 
      System.out.println("Copying properties from fromBean to toBean without setActDate"); 
      BeanUtils.copyProperties(toBean, fromBean); 
     } catch (IllegalAccessException e) { 
      e.printStackTrace(); 
     } catch (InvocationTargetException e) { 
      e.printStackTrace(); 
     } 
     System.out.println(ToStringBuilder.reflectionToString(fromBean.getId())); 
     System.out.println(ToStringBuilder.reflectionToString(toBean.getId())); 

     fromBean.getId().setActDate(toBean.getActDate()); 

     try { 
      System.out.println("Copying properties from fromBean to toBean with setActDate"); 
      BeanUtils.copyProperties(toBean, fromBean); 
     } catch (IllegalAccessException e) { 
      e.printStackTrace(); 
     } catch (InvocationTargetException e) { 
      e.printStackTrace(); 
     } 

     System.out.println(ToStringBuilder.reflectionToString(fromBean.getId())); 
     System.out.println(ToStringBuilder.reflectionToString(toBean.getId())); 
     System.out.println("==========END=========="); 
    } 

} 

Ch409DifF: 这是豆

package bean; 
import java.util.Date; 
public class Ch409DifF implements java.io.Serializable { 
private Ch409DifFId id; 
private String actDate; 
private String clerkNo; 
private String amt; 
private String invAmt; 
private String incAmt; 
private String pfsAmt; 
private String fee; 
private String pfsFee; 
private String beforeAmt; 
private String afterAmt; 
private String cardType; 
private String cardSeqNo; 
private String rwNo; 
private String samId; 
private String other; 
private String updFlag; 
private String updId; 
private String autoloadAmt; 
private String procFlag; 

public Ch409DifF() { 
} 

public Ch409DifF(Ch409DifFId id, String actDate, String updFlag) { 
    this.id = id; 
    this.actDate = actDate; 
    this.updFlag = updFlag; 
} 

public Ch409DifF(Ch409DifFId id, String actDate, String clerkNo, String amt, 
     String invAmt, String incAmt, String pfsAmt, String fee, 
     String pfsFee, String beforeAmt, String afterAmt, 
     String cardType, String cardSeqNo, String rwNo, String samId, 
     String other, String updFlag, String updId, String autoloadAmt,String procFlag) { 
    this.id = id; 
    this.actDate = actDate; 
    this.clerkNo = clerkNo; 
    this.amt = amt; 
    this.invAmt = invAmt; 
    this.incAmt = incAmt; 
    this.pfsAmt = pfsAmt; 
    this.fee = fee; 
    this.pfsFee = pfsFee; 
    this.beforeAmt = beforeAmt; 
    this.afterAmt = afterAmt; 
    this.cardType = cardType; 
    this.cardSeqNo = cardSeqNo; 
    this.rwNo = rwNo; 
    this.samId = samId; 
    this.other = other; 
    this.updFlag = updFlag; 
    this.updId = updId; 
    this.autoloadAmt = autoloadAmt; 
    this.procFlag = procFlag; 
} 

public Ch409DifFId getId() { 
    return this.id; 
} 

public void setId(Ch409DifFId id) { 
    this.id = id; 
} 

public String getActDate() { 
    return this.actDate; 
} 

public void setActDate(String actDate) { 
    this.actDate = actDate; 
} 

public String getClerkNo() { 
    return this.clerkNo; 
} 

public void setClerkNo(String clerkNo) { 
    this.clerkNo = clerkNo; 
} 

public String getAmt() { 
    return this.amt; 
} 

public void setAmt(String amt) { 
    this.amt = amt; 
} 

public String getInvAmt() { 
    return this.invAmt; 
} 

public void setInvAmt(String invAmt) { 
    this.invAmt = invAmt; 
} 

public String getIncAmt() { 
    return this.incAmt; 
} 

public void setIncAmt(String incAmt) { 
    this.incAmt = incAmt; 
} 

public String getPfsAmt() { 
    return this.pfsAmt; 
} 

public void setPfsAmt(String pfsAmt) { 
    this.pfsAmt = pfsAmt; 
} 

public String getFee() { 
    return this.fee; 
} 

public void setFee(String fee) { 
    this.fee = fee; 
} 

public String getPfsFee() { 
    return this.pfsFee; 
} 

public void setPfsFee(String pfsFee) { 
    this.pfsFee = pfsFee; 
} 

public String getBeforeAmt() { 
    return this.beforeAmt; 
} 

public void setBeforeAmt(String beforeAmt) { 
    this.beforeAmt = beforeAmt; 
} 

public String getAfterAmt() { 
    return this.afterAmt; 
} 

public void setAfterAmt(String afterAmt) { 
    this.afterAmt = afterAmt; 
} 

public String getCardType() { 
    return this.cardType; 
} 

public void setCardType(String cardType) { 
    this.cardType = cardType; 
} 

public String getCardSeqNo() { 
    return this.cardSeqNo; 
} 

public void setCardSeqNo(String cardSeqNo) { 
    this.cardSeqNo = cardSeqNo; 
} 

public String getRwNo() { 
    return this.rwNo; 
} 

public void setRwNo(String rwNo) { 
    this.rwNo = rwNo; 
} 

public String getSamId() { 
    return this.samId; 
} 

public void setSamId(String samId) { 
    this.samId = samId; 
} 

public String getOther() { 
    return this.other; 
} 

public void setOther(String other) { 
    this.other = other; 
} 

public String getUpdFlag() { 
    return this.updFlag; 
} 

public void setUpdFlag(String updFlag) { 
    this.updFlag = updFlag; 
} 

public String getUpdId() { 
    return this.updId; 
} 

public void setUpdId(String updId) { 
    this.updId = updId; 
} 

public String getAutoloadAmt() { 
    return this.autoloadAmt; 
} 

public void setAutoloadAmt(String autoloadAmt) { 
    this.autoloadAmt = autoloadAmt; 
} 

public String getProcFlag() { 
    return this.procFlag; 
} 

public void setProcFlag(String procFlag) { 
    this.procFlag = procFlag; 
} 

} 

ch490DifFId: 这是豆

package bean; 
import java.util.Date; 

public class Ch409DifFId implements java.io.Serializable { 

    private String storeNo; 
    private String taskId; 
    private String regId; 
    private String transType; 
    private String seqNo; 
    private String cardNo; 
    private String transDate; 
    private String transTime; 
    private String cardClass; 

    public Ch409DifFId() { 
    } 

    public Ch409DifFId(String storeNo, String taskId, String regId, 
      String transType, String seqNo, String cardNo, String transDate, 
      String transTime, String cardClass) { 
     this.storeNo = storeNo; 
     this.taskId = taskId; 
     this.regId = regId; 
     this.transType = transType; 
     this.seqNo = seqNo; 
     this.cardNo = cardNo; 
     this.transDate = transDate; 
     this.transTime = transTime; 
     this.cardClass = cardClass; 
    } 

    public String getStoreNo() { 
     return this.storeNo; 
    } 

    public void setStoreNo(String storeNo) { 
     this.storeNo = storeNo; 
    } 

    public String getTaskId() { 
     return this.taskId; 
    } 

    public void setTaskId(String taskId) { 
     this.taskId = taskId; 
    } 

    public String getRegId() { 
     return this.regId; 
    } 

    public void setRegId(String regId) { 
     this.regId = regId; 
    } 

    public String getTransType() { 
     return this.transType; 
    } 

    public void setTransType(String transType) { 
     this.transType = transType; 
    } 

    public String getSeqNo() { 
     return this.seqNo; 
    } 

    public void setSeqNo(String seqNo) { 
     this.seqNo = seqNo; 
    } 

    public String getCardNo() { 
     return this.cardNo; 
    } 

    public void setCardNo(String cardNo) { 
     this.cardNo = cardNo; 
    } 

    public String getTransDate() { 
     return this.transDate; 
    } 

    public void setTransDate(String transDate) { 
     this.transDate = transDate; 
    } 

    public String getTransTime() { 
     return this.transTime; 
    } 

    public void setTransTime(String transTime) { 
     this.transTime = transTime; 
    } 

    public String getCardClass() { 
     return this.cardClass; 
    } 

    public void setCardClass(String cardClass) { 
     this.cardClass = cardClass; 
    } 

    public boolean equals(Object other) { 
     if ((this == other)) 
      return true; 
     if ((other == null)) 
      return false; 
     if (!(other instanceof Ch409DifFId)) 
      return false; 
     Ch409DifFId castOther = (Ch409DifFId) other; 

     return ((this.getStoreNo() == castOther.getStoreNo()) || (this 
       .getStoreNo() != null && castOther.getStoreNo() != null && this 
       .getStoreNo().equals(castOther.getStoreNo()))) 
       && ((this.getTaskId() == castOther.getTaskId()) || (this 
         .getTaskId() != null && castOther.getTaskId() != null && this 
         .getTaskId().equals(castOther.getTaskId()))) 
       && ((this.getRegId() == castOther.getRegId()) || (this 
         .getRegId() != null && castOther.getRegId() != null && this 
         .getRegId().equals(castOther.getRegId()))) 
       && ((this.getTransType() == castOther.getTransType()) || (this 
         .getTransType() != null 
         && castOther.getTransType() != null && this 
         .getTransType().equals(castOther.getTransType()))) 
       && ((this.getSeqNo() == castOther.getSeqNo()) || (this 
         .getSeqNo() != null && castOther.getSeqNo() != null && this 
         .getSeqNo().equals(castOther.getSeqNo()))) 
       && ((this.getCardNo() == castOther.getCardNo()) || (this 
         .getCardNo() != null && castOther.getCardNo() != null && this 
         .getCardNo().equals(castOther.getCardNo()))) 
       && ((this.getTransDate() == castOther.getTransDate()) || (this 
         .getTransDate() != null 
         && castOther.getTransDate() != null && this 
         .getTransDate().equals(castOther.getTransDate()))) 
       && ((this.getTransTime() == castOther.getTransTime()) || (this 
         .getTransTime() != null 
         && castOther.getTransTime() != null && this 
         .getTransTime().equals(castOther.getTransTime()))) 
       && (this.getCardClass() == castOther.getCardClass()); 
    } 

    public int hashCode() { 
     int result = 17; 

     result = 37 * result 
       + (getStoreNo() == null ? 0 : this.getStoreNo().hashCode()); 
     result = 37 * result 
       + (getTaskId() == null ? 0 : this.getTaskId().hashCode()); 
     result = 37 * result 
       + (getRegId() == null ? 0 : this.getRegId().hashCode()); 
     result = 37 * result 
       + (getTransType() == null ? 0 : this.getTransType().hashCode()); 
     result = 37 * result 
       + (getSeqNo() == null ? 0 : this.getSeqNo().hashCode()); 
     result = 37 * result 
       + (getCardNo() == null ? 0 : this.getCardNo().hashCode()); 
     result = 37 * result 
       + (getTransDate() == null ? 0 : this.getTransDate().hashCode()); 
     result = 37 * result 
       + (getTransTime() == null ? 0 : this.getTransTime().hashCode()); 
     result = 37 * result + (getCardClass() == null ? 0 : this.getCardClass().hashCode()); 
     return result; 
    } 

} 

Ch409F: 这是豆

package bean; 

import java.util.Date; 
public class Ch409F implements java.io.Serializable { 

    private Ch409FId id; 
    private String clerkNo; 
    private String amt; 
    private String invAmt; 
    private String incAmt; 
    private String pfsAmt; 
    private String fee; 
    private String pfsFee; 
    private String beforeAmt; 
    private String afterAmt; 
    private String cardType; 
    private String cardSeqNo; 
    private String rwNo; 
    private String samId; 
    private String autoloadAmt; 
    private String other; 
    private String sendDate; 
    private String updFlag; 
    private String updId; 
    private String updDate; 

    public Ch409F() { 
    } 

    public Ch409F(Ch409FId id, String updFlag) { 
     this.id = id; 
     this.updFlag = updFlag; 
    } 

    public Ch409F(Ch409FId id, String clerkNo, String amt, String invAmt, 
      String incAmt, String pfsAmt, String fee, String pfsFee, 
      String beforeAmt, String afterAmt, String cardType, 
      String cardSeqNo, String rwNo, String samId, String autoloadAmt, 
      String other, String sendDate, String updFlag, String updId, 
      String updDate) { 
     this.id = id; 
     this.clerkNo = clerkNo; 
     this.amt = amt; 
     this.invAmt = invAmt; 
     this.incAmt = incAmt; 
     this.pfsAmt = pfsAmt; 
     this.fee = fee; 
     this.pfsFee = pfsFee; 
     this.beforeAmt = beforeAmt; 
     this.afterAmt = afterAmt; 
     this.cardType = cardType; 
     this.cardSeqNo = cardSeqNo; 
     this.rwNo = rwNo; 
     this.samId = samId; 
     this.autoloadAmt = autoloadAmt; 
     this.other = other; 
     this.sendDate = sendDate; 
     this.updFlag = updFlag; 
     this.updId = updId; 
     this.updDate = updDate; 
    } 

    public Ch409FId getId() { 
     return this.id; 
    } 

    public void setId(Ch409FId id) { 
     this.id = id; 
    } 

    public String getClerkNo() { 
     return this.clerkNo; 
    } 

    public void setClerkNo(String clerkNo) { 
     this.clerkNo = clerkNo; 
    } 

    public String getAmt() { 
     return this.amt; 
    } 

    public void setAmt(String amt) { 
     this.amt = amt; 
    } 

    public String getInvAmt() { 
     return this.invAmt; 
    } 

    public void setInvAmt(String invAmt) { 
     this.invAmt = invAmt; 
    } 

    public String getIncAmt() { 
     return this.incAmt; 
    } 

    public void setIncAmt(String incAmt) { 
     this.incAmt = incAmt; 
    } 

    public String getPfsAmt() { 
     return this.pfsAmt; 
    } 

    public void setPfsAmt(String pfsAmt) { 
     this.pfsAmt = pfsAmt; 
    } 

    public String getFee() { 
     return this.fee; 
    } 

    public void setFee(String fee) { 
     this.fee = fee; 
    } 

    public String getPfsFee() { 
     return this.pfsFee; 
    } 

    public void setPfsFee(String pfsFee) { 
     this.pfsFee = pfsFee; 
    } 

    public String getBeforeAmt() { 
     return this.beforeAmt; 
    } 

    public void setBeforeAmt(String beforeAmt) { 
     this.beforeAmt = beforeAmt; 
    } 

    public String getAfterAmt() { 
     return this.afterAmt; 
    } 

    public void setAfterAmt(String afterAmt) { 
     this.afterAmt = afterAmt; 
    } 

    public String getCardType() { 
     return this.cardType; 
    } 

    public void setCardType(String cardType) { 
     this.cardType = cardType; 
    } 

    public String getCardSeqNo() { 
     return this.cardSeqNo; 
    } 

    public void setCardSeqNo(String cardSeqNo) { 
     this.cardSeqNo = cardSeqNo; 
    } 

    public String getRwNo() { 
     return this.rwNo; 
    } 

    public void setRwNo(String rwNo) { 
     this.rwNo = rwNo; 
    } 

    public String getSamId() { 
     return this.samId; 
    } 

    public void setSamId(String samId) { 
     this.samId = samId; 
    } 

    public String getAutoloadAmt() { 
     return this.autoloadAmt; 
    } 

    public void setAutoloadAmt(String autoloadAmt) { 
     this.autoloadAmt = autoloadAmt; 
    } 

    public String getOther() { 
     return this.other; 
    } 

    public void setOther(String other) { 
     this.other = other; 
    } 

    public String getSendDate() { 
     return this.sendDate; 
    } 

    public void setSendDate(String sendDate) { 
     this.sendDate = sendDate; 
    } 

    public String getUpdFlag() { 
     return this.updFlag; 
    } 

    public void setUpdFlag(String updFlag) { 
     this.updFlag = updFlag; 
    } 

    public String getUpdId() { 
     return this.updId; 
    } 

    public void setUpdId(String updId) { 
     this.updId = updId; 
    } 

    public String getUpdDate() { 
     return this.updDate; 
    } 

    public void setUpdDate(String updDate) { 
     this.updDate = updDate; 
    } 

} 

Ch409FId: 这是豆

package bean; 

import java.util.Date; 
public class Ch409FId implements java.io.Serializable { 

    private String storeNo; 
    private String actDate; 
    private String taskId; 
    private String regId; 
    private String transType; 
    private String seqNo; 
    private String cardNo; 
    private String transDate; 
    private String transTime; 
    private String cardClass; 

    public Ch409FId() { 
    } 

    public Ch409FId(String storeNo, String actDate, String taskId, String regId, 
      String transType, String seqNo, String cardNo, String transDate, 
      String transTime, String cardClass) { 
     this.storeNo = storeNo; 
     this.actDate = actDate; 
     this.taskId = taskId; 
     this.regId = regId; 
     this.transType = transType; 
     this.seqNo = seqNo; 
     this.cardNo = cardNo; 
     this.transDate = transDate; 
     this.transTime = transTime; 
     this.cardClass = cardClass; 
    } 

    public String getStoreNo() { 
     return this.storeNo; 
    } 

    public void setStoreNo(String storeNo) { 
     this.storeNo = storeNo; 
    } 

    public String getActDate() { 
     return this.actDate; 
    } 

    public void setActDate(String actDate) { 
     this.actDate = actDate; 
    } 

    public String getTaskId() { 
     return this.taskId; 
    } 

    public void setTaskId(String taskId) { 
     this.taskId = taskId; 
    } 

    public String getRegId() { 
     return this.regId; 
    } 

    public void setRegId(String regId) { 
     this.regId = regId; 
    } 

    public String getTransType() { 
     return this.transType; 
    } 

    public void setTransType(String transType) { 
     this.transType = transType; 
    } 

    public String getSeqNo() { 
     return this.seqNo; 
    } 

    public void setSeqNo(String seqNo) { 
     this.seqNo = seqNo; 
    } 

    public String getCardNo() { 
     return this.cardNo; 
    } 

    public void setCardNo(String cardNo) { 
     this.cardNo = cardNo; 
    } 

    public String getTransDate() { 
     return this.transDate; 
    } 

    public void setTransDate(String transDate) { 
     this.transDate = transDate; 
    } 

    public String getTransTime() { 
     return this.transTime; 
    } 

    public void setTransTime(String transTime) { 
     this.transTime = transTime; 
    } 

    public String getCardClass() { 
     return this.cardClass; 
    } 

    public void setCardClass(String cardClass) { 
     this.cardClass = cardClass; 
    } 

    public boolean equals(Object other) { 
     if ((this == other)) 
      return true; 
     if ((other == null)) 
      return false; 
     if (!(other instanceof Ch409FId)) 
      return false; 
     Ch409FId castOther = (Ch409FId) other; 

     return ((this.getStoreNo() == castOther.getStoreNo()) || (this 
       .getStoreNo() != null && castOther.getStoreNo() != null && this 
       .getStoreNo().equals(castOther.getStoreNo()))) 
       && ((this.getActDate() == castOther.getActDate()) || (this 
         .getActDate() != null && castOther.getActDate() != null && this 
         .getActDate().equals(castOther.getActDate()))) 
       && ((this.getTaskId() == castOther.getTaskId()) || (this 
         .getTaskId() != null && castOther.getTaskId() != null && this 
         .getTaskId().equals(castOther.getTaskId()))) 
       && ((this.getRegId() == castOther.getRegId()) || (this 
         .getRegId() != null && castOther.getRegId() != null && this 
         .getRegId().equals(castOther.getRegId()))) 
       && ((this.getTransType() == castOther.getTransType()) || (this 
         .getTransType() != null 
         && castOther.getTransType() != null && this 
         .getTransType().equals(castOther.getTransType()))) 
       && ((this.getSeqNo() == castOther.getSeqNo()) || (this 
         .getSeqNo() != null && castOther.getSeqNo() != null && this 
         .getSeqNo().equals(castOther.getSeqNo()))) 
       && ((this.getCardNo() == castOther.getCardNo()) || (this 
         .getCardNo() != null && castOther.getCardNo() != null && this 
         .getCardNo().equals(castOther.getCardNo()))) 
       && ((this.getTransDate() == castOther.getTransDate()) || (this 
         .getTransDate() != null 
         && castOther.getTransDate() != null && this 
         .getTransDate().equals(castOther.getTransDate()))) 
       && ((this.getTransTime() == castOther.getTransTime()) || (this 
         .getTransTime() != null 
         && castOther.getTransTime() != null && this 
         .getTransTime().equals(castOther.getTransTime()))) 
       && (this.getCardClass() == castOther.getCardClass()); 
    } 

    public int hashCode() { 
     int result = 17; 

     result = 37 * result 
       + (getStoreNo() == null ? 0 : this.getStoreNo().hashCode()); 
     result = 37 * result 
       + (getActDate() == null ? 0 : this.getActDate().hashCode()); 
     result = 37 * result 
       + (getTaskId() == null ? 0 : this.getTaskId().hashCode()); 
     result = 37 * result 
       + (getRegId() == null ? 0 : this.getRegId().hashCode()); 
     result = 37 * result 
       + (getTransType() == null ? 0 : this.getTransType().hashCode()); 
     result = 37 * result 
       + (getSeqNo() == null ? 0 : this.getSeqNo().hashCode()); 
     result = 37 * result 
       + (getCardNo() == null ? 0 : this.getCardNo().hashCode()); 
     result = 37 * result 
       + (getTransDate() == null ? 0 : this.getTransDate().hashCode()); 
     result = 37 * result 
       + (getTransTime() == null ? 0 : this.getTransTime().hashCode()); 
     result = 37 * result + (getCardClass() == null ? 0 : this.getCardClass().hashCode()); 
     return result; 
    } 

} 

回答

-1

我更换了一些代码:

Ch409F fromBean = new Ch409F(); 
//add 
Ch409FId c409fid = new Ch409FId(); 
fromBean.setId(c409fid); 

Ch409DifF toBean = new Ch409DifF(); 
//add 
Ch409DifFId c409diffid = new Ch409DifFId(); 
toBean.setId(c409diffid); 

和替换

System.out.println(ToStringBuilder.reflectionToString(fromBean); 
System.out.println(ToStringBuilder.reflectionToString(toBean); 

System.out.println(ToStringBuilder.reflectionToString(fromBean.getId())); 
System.out.println(ToStringBuilder.reflectionToString(toBean.getId())); 

它的工作!

+0

你正在做一件事,这是行不通的。现在你发布 - 作为一个答案 - 你正在做其他事情,而其他的事情也会发挥作用。但这不是你自己问题的答案,所以请不要将它作为答案发布。 –

0

你是不是为标识ID创建Ch409DifF的对象。所以,当你调用的getID(),它返回对象的。所以无论是使用构造与3个参数为空,默认值,

public Ch409DifF(Ch409DifFId id, String actDate, String updFlag) { 

OR

public Ch409DifF(Ch409DifFId id, String actDate, String clerkNo, String amt, 
    String invAmt, String incAmt, String pfsAmt, String fee, 
    String pfsFee, String beforeAmt, String afterAmt, 
    String cardType, String cardSeqNo, String rwNo, String samId, 
    String other, String updFlag, String updId, String autoloadAmt,String procFlag) {