title: JPA + hibernate foreign key is null
body: <p>I have 2 tables in my database. I have got a Project which can have multiple builds. One build belongs to one project. Everything works fine, except the foreign key in my build table remains null.</p>
  <p>Project</p>
  <pre><code>@Entity(name=&quot;project&quot;)
  public class Project implements Serializable {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = &quot;projectID&quot;)
  private Long id;
  
  @Column
  @JsonProperty(&quot;displayName&quot;)
  private String name;
  
  @JsonProperty(&quot;builds&quot;)
  @JsonIgnore
  @LazyCollection(LazyCollectionOption.FALSE)
  @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = (&quot;project&quot;))
  private Collection&lt;Build&gt; builds;
  
  public Project() {
  }
  
  public Project(String name) {
      this.name = name;
  }
  
  public Collection&lt;Build&gt; getBuilds() {
      return builds;
  }
  
  public void setBuilds(Collection&lt;Build&gt; builds) {
      this.builds = builds;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public Long getId() {
      return id;
  }
  
  public void setId(Long id) {
      this.id = id;
  }
  
  @Override
  public String toString() {
      return ToStringBuilder.reflectionToString(this);
  }
  }
  </code></pre>
  <p>Build</p>
  <pre><code>@Entity(name = &quot;build&quot;)
  public class Build implements Serializable {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;
  
  @Column
  @JsonProperty(&quot;number&quot;)
  private Integer number;
  
  @Column
  @JsonProperty(&quot;url&quot;)
  private String url;
  
  @JsonBackReference
  @ManyToOne
  @OnDelete(action = OnDeleteAction.CASCADE)
  @JoinColumn(name = &quot;project&quot;)
  private Project project;
  
  public Build() {
  }
  
  public Build(String url, Project project, Integer number) {
      this.url = url;
      this.project = project;
      this.number = number;
  }
  
  public Long getId() {
      return id;
  }
  
  public Integer getNumber() {
      return number;
  }
  
  public String getUrl() {
      return url;
  }
  
  public void setId(Long id) {
      this.id = id;
  }
  
  public void setNumber(Integer number) {
      this.number = number;
  }
  
  public void setUrl(String url) {
      this.url = url;
  }
  
  public Project getProject() {
      return project;
  }
  
  public void setProject(Project project) {
      this.project = project;
  }
  }
  </code></pre>
  <p>Does anyone see the problem?</p>