save2 [JPA] update가 왜 안되는거지..? (detached to persistent) 문제의 메소드 @PostMapping("/settings/profile") public String updateProfile(@CurrentUser Account account, @Valid Profile profile, Errors errors, Model model){ if(errors.hasErrors()){ model.addAttribute(account); return "/settings/profile"; } //데이터 변경 작업은 서비스 쪽에 위임 accountService.updateProfile(account, profile); //사용자의 form submit이 다시 일어나지 않도록 redirect return "redirect:/" + "settings/profile"; } 분명히 up.. 2020. 7. 21. JPA repository.save is Null (NullPointerException) - feat. @RunWith & @SpringBootTest & @DataJpaTest JPA로 save 를 작성해보던 도중 @Autowired private UserRepository userRepository; @Test public void create(){ System.out.println(userRepository); User user = new User(); user.setAccount("TestUser01"); user.setEmail("TestUser01@gmail.com"); user.setPhoneNumber("010-1111-1111"); user.setCreatedAt(LocalDateTime.now()); user.setCreatedBy("admin"); System.out.println(user); User newUser = userRepository.save(us.. 2019. 11. 13. 이전 1 다음