问题描述
在一个循环中,通过JPA进行查找后,修改查找后的值,导致数据库的值修改了
for (Integer integer : condition.getResourceIds()) {
List<Integer> tempResourceIds = workTeamDao.findAllTeamListByTeamName(String.valueOf(integer));
SchedulingEvent tempSchedulingEvent =
dao.findTopByStartBetweenAndResourceIdIn(condition.getStart(),
condition.getEnd(),
tempResourceIds);
if(tempSchedulingEvent!=null){
tempSchedulingEvent.setResourceId(integer);
schedulingEvents.add(tempSchedulingEvent);
}
}
问题解决
通过BeanUtils.copyPr