本帖最后由 c517984604 于 2011-06-27 11:20:18 编辑

解决方案 »

  1.   

    参与事务的是IStudentService.addStudent,不是StudentAction
      

  2.   

    这是你的业务逻辑有问题了 你为什么不一次提交 一个对象集合给你的service 这样才能起到事务控制的作用
      

  3.   

    我改成这这样的也不行啊
    @Override
    @Transactional(readOnly=false,propagation=Propagation.REQUIRED,rollbackFor=Exception.class)
    public boolean addStudent(Student student) {
    try {
     commonDao.insertSingle(student);
     student.setStuname("1111111111111111111111");
     commonDao.updateById(student, "classno");

    } catch (Exception e) {
    e.printStackTrace();
    }
    return true;
    }
    一个添加和一个修改但是那个修改是错误的也没有回滚!