title: Detached entity passed to persist when POST
body: <p>I'm trying to add a join between two tables as I stated in this question: <a href="https://stackoverflow.com/questions/35925510/adding-table-joins-to-existing-project-causes-infinite-recursion/35934569#35934569">Adding table joins to existing project causes infinite recursion</a></p>
  
  <p>However now I got a new error which states:</p>
  
  <pre><code>detached entity passed to persist: sample.todosapp.spring.domain.User] with root cause
  </code></pre>
  
  <p>When I try to call this code (this is modified method for POST in my REST controller):</p>
  
  <pre><code>    @RequestMapping(method = POST)
  @ResponseStatus(HttpStatus.CREATED)
  public Callable&lt;Todo&gt; post(@RequestBody Todo todo) {
      User u = userService.findBySso(SecurityContextHolder.getContext().getAuthentication().getName());
  
      todo.setUser(u);
      return () -&gt; todoRepository.save(todo);
  }
  </code></pre>
  
  <p>How do you add a join during POST?</p>