title: MappingException: Repeated column in mapping for entity: ... column: dept_id (should be mapped with insert="false" update="false")
body: <p>I know there are similar questions here, but for some reason they just don't work for me. Here, I can't even find which column is repeated. The basic idea of the system is that using a join on deptId (FK), I can get all the employees in a certain department.</p>
  
  <p>I have reproduced below the relevant code:</p>
  
  <p>Employee.java</p>
  
  <pre><code>    package com.tvlk.advDemo.model;
  
      import javax.persistence.*;
      import javax.swing.*;
      import java.io.Serializable;
  
      @Entity
      @Table(name="employees")
      public class Employee implements Serializable {
          private long id;
          private String name;
          private String designation;
          private long deptId;
          private Department department;
  
          public Employee() {
  
          }
  
          public Employee(String name, String designation, long deptId) {
              this.name = name;
              this.designation = designation;
              this.deptId = deptId;
          }
  
          @Id
          @GeneratedValue
          public long getId() {
              return id;
          }
          public void setId(long id) {
              this.id = id;
          }
  
          @Column(name = "name", nullable = false)
          public String getName() {
              return name;
          }
          public void setName(String name) {
              this.name = name;
          }
  
          @Column(name = "designation", nullable = false)
          public String getDesignation() {
              return designation;
          }
          public void setDesignation(String designation) {
              this.designation = designation;
          }
  
      //    @Column(name = "deptId", nullable = false)
          public long getDeptId() {
              return deptId;
          }
          public void setDeptId(long deptId) {
              this.deptId = deptId;
          }
  
          @ManyToOne(fetch = FetchType.LAZY)
          @JoinColumn(name = "deptId", nullable = false)
          public Department getDepartment() {
              return department;
          }
  
          public void setDepartment(Department department){
              this.department = department;
          }
  
  
          @Override
          public String toString() {
              return "Employee [id=" + id + ", name=" + name + ", designation=" + designation + ", deptId=" + deptId
                      + "]";
          }
      }
  </code></pre>
  
  <p>Here is Department.java</p>
  
  <pre><code>package com.tvlk.advDemo.model;
  
  import javax.persistence.*;
  import java.io.Serializable;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  
  @Entity
  @Table(name="departments")
  public class Department implements Serializable {
      private long id;
      private String deptName;
      private String deptHead;
      private long budget;
      private List&lt;Employee&gt; employees;
  
  
      public Department(){
  
      }
  
      public Department(long id, String deptName, String deptHead, long budget)
      {
          this.id = id;
          this.deptHead = deptHead;
          this.deptName = deptName;
          this.budget = budget;
      }
  
      @Id
      public long getId() {return id;}
      public void setId(long id) {this.id = id; }
  
      @Column(name = "name", nullable = false)
      public String getDeptName(){return deptName;}
      public void setDeptName(String deptName){this.deptName = deptName; }
  
      @Column(name = "deptHead", nullable = false)
      public String getDeptHead(){return deptHead; }
      public void setDeptHead(String deptHead){this.deptHead = deptHead; }
  
      @Column(name = "budget", nullable = false)
      public long getBudget(){return budget;}
      public void setBudget(long budget){this.budget = budget; }
  
      @OneToMany(fetch = FetchType.LAZY, mappedBy = "id", targetEntity = Employee.class)
      public List&lt;Employee&gt; getEmployees() {
          return this.employees;
      }
  
      public void setEmployees(List&lt;Employee&gt; employees) {
          this.employees = employees;
      }
  }
  </code></pre>
  
  <p>Any help will be appreciated, I am quite new to springboot and hibernate. Note that I am making REST APIs for CRUD operations using H2.</p>