Asked thg 2 23, 2024 7:19 SA 103 0 1
  • 103 0 1
0

@CachePut

Share
  • 103 0 1

image.png Mình viết 1 crud về student bằng spring boot và ở service update này mình có dùng @CachePut nhưng tại sao nó lại không hoạt động?

1 ANSWERS


Answered thg 2 23, 2024 7:35 SA
0

B sửa student.id -> #student.id r chạy lại xem

Share
thg 2 23, 2024 7:40 SA

mình vừa thử xong và vẫn không được ạ

0
| Reply
Share
thg 2 23, 2024 8:07 SA

@truongannv bạn gửi lỗi lên để mọi người xem bị lỗi gì

0
| Reply
Share
thg 2 23, 2024 8:30 SA

@giang.nt mình call API update Student nó update trong csdl nhưng lại không update trong cache2

0
| Reply
Share
thg 2 23, 2024 9:48 SA

@truongannv B thử sửa như này xem:

...}else{
    Student existingStudent = student1.get();
    existingStudent.setId(student.getId();
    ....
  studentRepository.save(existingStudent);
  return ResponseEntity.ok(existingStudent);
}
0
| Reply
Share
Viblo
Let's register a Viblo Account to get more interesting posts.