日期:2014-05-20  浏览次数:20832 次

LIST中SET方法不执行(相关代码如下),跪求!!!!!
List<CostExpenseItem> list = (List<CostExpenseItem>) base.getAttribute("items");
boolean success = true;
if (list != null && list.size() > 0) {
List<CostExpenseItem> dbItms = new ArrayList<CostExpenseItem>();
CostExpenseItem dbitm = null;
for (CostExpenseItem itm : list) {
dbitm = (CostExpenseItem) dao.execute(CostExpenseItem.class, itm.getId());
if (dbitm != null) {
dbitm.setSubjectCodeAccount(itm.getSubjectCodeAccount());
dbitm.setSubjectCodeFact(itm.getSubjectCodeFact());
dbitm.setSummary(itm.getSummary());
dbitm.setInvoiceCode(itm.getInvoiceCode());
dbitm.setInvoiceNum(itm.getInvoiceNum());
dbitm.setDays(itm.getDays());
dbitm.setPlace(itm.getPlace());
dbitm.setHappenDate(itm.getHappenDate());
dbitm.setEndDate(itm.getEndDate());
dbItms.add(dbitm);
}


------解决方案--------------------
set方法不执行,说明dbitm 为null嘛;
进而说明dao.execute(CostExpenseItem.class, itm.getId())执行的结果为空;
这时再看itm.getId()是不是为空,或者itm是不是为空。调试一遍,看是哪的问题嘛。