关于死锁,我用的是springmvc框架,事物在service层创建
大概的操作是这样的:学生表student,选课表elective
选课表与考生表关联的
boolean checkElective(string sids, string state){
//sids是学生id的拼接,大概像1,2,3这样
//把每一个id转成integer,具体代码先省略
integer[] sid = ....;
list<elective> electives = new arrayList<elective>();
list<student> students = new arrayList<students>();
foreach(int studentid : sid){
Student student = getById(studentid);
student.setTime(time);
students.add(student);
Elective elective = getEleByStudent(studentid);
elective.setState('成功');
electives.add(elective);
}
baseDao.save(electives) && baseDao.save(students);
}
项目的大概意思是这样的,测试的时候没有问题,也没有报错。
但是部署到服务器上之后,数据一多就报死锁的错误
org.springframework.dao.ConnotAcquireLockException:Could not execute JDBC batch update;
是报错在students保存的时候
求教各位大神
www说
慕妹3146593
随时随地看视频慕课网APP
相关分类