java - Hibernate重复更新导致系统变慢直至崩溃
PHP中文网
PHP中文网 2017-04-18 09:48:04
0
0
437

系统采用SSH框架,数据库采用db2,在一个重复更新数据库的时候,会发现系统越来越慢,最后到系统直接不能访问,查看日志都没有报错信息,各位大神看看是什么原因。(数据量比较大,其中lettercode加了索引)

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public void bounceIn(String lettercode, String refusereason,
String refusetime, OperateResult result, Log log) {
try {
StringBuilder hql = new StringBuilder("from PrintInfo where 1=1");
ArrayList<Object> params = new ArrayList<Object>();
if (!"".equalsIgnoreCase(lettercode) || lettercode == null) {
hql.append("and lettercode =? order by sendtime desc");//根据lettercode获取最近的一条数据
params.add(lettercode);
List<PrintInfo> printInfoList = printInfoDao.listEntityByHQL(
hql.toString(), params.toArray());
if (printInfoList != null && printInfoList.size() > 0) {
PrintInfo printInfo = printInfoList.get(0);
LetterInfo letterInfo = printInfo.getLetterInfo();
String statep = letterInfo.getStatep();
if ("5".equals(statep)) {
printInfo.setRefusereason(refusereason);
DateFormat fmt = new SimpleDateFormat(
"yyyy-MM-dd%2520HH:mm:ss");
Date date = null;
try {
date = fmt.parse(refusetime);
} catch (ParseException e1) {
e1.printStackTrace();
}
printInfo.setRefusetime(date);
printInfoDao.update(printInfo);
letterInfo.setStatep("6");
letterInfoDao.update(letterInfo);
result.setSuccess(true);
result.setResult("退信录入成功");
log.setState("记录");
log.setDescribe("退信录入成功");
} else {
result.setSuccess(false);
result.setResult("只能录入已寄送的信函");
log.setState("警告");
log.setDescribe("退信录入失败");
}
}
} else {
result.setSuccess(false);
result.setResult("没有找到该条记录");
log.setState("警告");
log.setDescribe("查找失败");
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}

}
PHP中文网
PHP中文网

认证0级讲师

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template