学生编辑不行(Java+Spring+MySQl)?

我有一份学生名单。我想做编辑。更改名称、姓氏和头像。我写了代码,但它不起作用,数据没有被编辑。你可以看到为什么它对我不起作用。没有错误,它只是没有改变任何东西。编辑后姓名和头像不变


学生服务


public interface StudentService {


    List<Student> getAllStudents();


    Student getStudentById(Long id);


    boolean saveStudent(Student student);


    boolean deleteStudentById(Long id);


    File loadAvatarByFileName(String filename);


    File saveAvatarImage(MultipartFile avatarImage) throws IOException;


        Student updateStudent(String name, String surname, MultipartFile avatar, Student targetStudent) throws IOException;

}


幕布斯6054654
浏览 96回答 1
1回答

HUH函数

该错误表明另一个进程正在使用该文件,因此无法将其删除。您是否在另一个程序中打开了给定的文件?可能是您的代码在您尝试删除文件时打开文件/在另一个地方保持打开状态吗?我看到您的 StudentServiceImpl.updateStudent 调用了Files.deleteIfExists(Paths.get(storageLocation + File.separator + oldAvatarName));两次。根据堆栈跟踪,违规行是StudentServiceImpl.java:122.&nbsp;这两行中哪一行是数字 122?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java