MyBatis的XML中association和collection的区别

这个我也踩了一个误区,以为它两没什么区别。后面在写代码中一直报错说是参数类型不匹配,报错如下:
Could not set property ‘custBalances’ of ‘class com.sunline.portrait.modules.risk.bean.CustBalanceRisk’ with value ‘CustBalance(dataDate=Fri Jun 05 00:00:00 CST 2020, ciNo=12232, total=5327637, depositTotal=123144, loanTotal=34424, wealthTotal=24232423, fundTotal=2423432532, depositBalHistoryHighest=43536, loanBalHistoryHighest=454543, balHistoryHighest=5353, creditCordBalHistoryHighest=353535, ranking=535353, depositRanking=53453, loanRanking=3533)’ Cause: java.lang.IllegalArgumentException: argument type mismatch
后面通过查资料才知道:
      association: 处理一对一、多对一
      collection: 处理一对多

你可能感兴趣的:(mybatis,spring,java,sql,mysql)