Notice
Recent Posts
Recent Comments
Link
«   2026/09   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

helloworld

jpa / delete 기능 본문

restful

jpa / delete 기능

hellojava 2023. 8. 24. 22:37

delete는 정말 쉽다...

 

delete는 리턴 받을 것이 없기 때문에 물론 받게하려면 받을 수 있겠지만..

 

우선 @DeleteMapping으로 시작한다.

 

@DeleteMapping("/users/{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