helloworld
jpa / delete 기능 본문
delete는 정말 쉽다...
delete는 리턴 받을 것이 없기 때문에 물론 받게하려면 받을 수 있겠지만..
우선 @DeleteMapping으로 시작한다.
@DeleteMapping("/users/{id}")
public void deleteUser(@PathVariable int id) {
userRepository.deleteById(id);
}
public void deleteUser(@PathVariable int id) {
userRepository.deleteById(id);
}
가변변수를 사용해야하기 때문에 pathvariable 을 사용해주고
jpa 메서드인 deleteById 하면 끝...
'restful' 카테고리의 다른 글
| 간단한 메모장? 기능 만들기 (0) | 2023.08.24 |
|---|---|
| jpa/ insert (0) | 2023.08.24 |
| jpa / id값으로 유저정보 가져오기 (0) | 2023.08.24 |
| jpa crud기능 사용(select) (0) | 2023.08.24 |
| jpa/ h2 (0) | 2023.08.24 |