查找实体,并循环子集记录。
try { String pigeonholeId=request.getParameter("pigeonholeId"); Pigeonhole p=pigeonholeService.get(pigeonholeId); p.setIsDelete(0); p.setDeleteReason(null); p.setDeleteTime(null); p.setDeletePerson(null); pigeonholeService.update(p); //将借阅记录中的删除记录清除 String hql=" from Borrow where pigeonholeId=?"; List<Borrow> borrowList=borrowService.findByHql(hql, new Object[]{pigeonholeId}); if(borrowList != null && borrowList.size()>0){ for(Borrow b:borrowList){ b.setIsRead(0); borrowService.update(b); } } } catch (Exception e) { logger.error("异常_",e); }