title: Saving data on jpa hibernate table gives null on join columns
body: <p>I have two  tables which are related to each other, table &quot;user&quot; and &quot;address&quot;:</p>
  <pre><code>@Entity
  @Table(name = &quot;user&quot;)
  @Data
  public class User{
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Integer id;
  
      @NotNull
      @Column(unique = true)
      private String user_name;
  
      @Column
      private String description;
  
      @OneToMany(mappedBy = &quot;user&quot;, cascade = CascadeType.ALL, orphanRemoval = true)
      protected Set&lt;Address&gt; addresses= new HashSet&lt;&gt;();
  }
  </code></pre>
  <p>While in the other table:</p>
  <pre><code>@Entity
  @Table(name = &quot;address&quot;)
  @Data
  public class Address{
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Integer id;
  
      @ManyToOne
      @JoinColumn(name = &quot;user_id&quot;)
      protected User user;
  
      private String description;
  }
  </code></pre>
  <p>I did a post request to create new user with some addresses:</p>
  <pre><code>@PostMapping (&quot;/user/create&quot;)
  public ResponseEntity post(@RequestBody User user) {
      userService.saveNewUser(user);
       // return
  }
  </code></pre>
  <p>In a post request I sent this json:</p>
  <pre><code>{
   
    &quot;user_name&quot;: &quot;example&quot;,
    &quot;description&quot;: &quot;this is a  user description&quot;,
    &quot;addresses&quot;: [
      {
        &quot;description&quot;: &quot;this is a address 1&quot;
      },
      {
        &quot;description&quot;: &quot;this is a address 2&quot;
      }
    ]
  }
  </code></pre>
  <p>When I insert data I get the &quot;address&quot; table the &quot;user_id&quot; is null, the data are inserted but the relations are not there?
  What I'm doing wrong here?  Please help!</p>
  <p>Update:  Let's say I have this method saveNewUser on the service, how to call update Address?</p>
  <pre><code>public Oject saveNewUser(User user ) {
         // 
          return jpaRepository.save(user);
      }
  </code></pre>