title: java.lang.IllegalStateException: Required identifier property not found
body: <p>I keep getting this exception while I'm trying to save an object to an H2 database.</p>
  
  <p>The object I'm trying to persist is defined as following: </p>
  
  <pre><code>package mypackage.foo.core.jpa.domain;
  
  @Entity
  @Getter
  @NoArgsConstructor
  public class Task implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Setter
      private Long id;
  
      private String name;
      private String description;
  </code></pre>
  
  <p><strong>The controller:</strong></p>
  
  <pre><code>package mypackage.foo.core.web.controller;
  
  @RestController
  @RequiredArgsConstructor
  public class TaskController {
  
      private final TaskService taskService;
  
      @PostMapping("/api/task/save")
      public ResponseEntity&lt;Task&gt; handlePostAddTask(@RequestBody Task task) {
          Task savedTask = taskService.save(task);
  
          return new ResponseEntity&lt;&gt;(savedTask, HttpStatus.CREATED);
      }
  }
  </code></pre>
  
  <p><strong>The payload that I'm sending to that endpoint via Postman:</strong></p>
  
  <pre><code>{
      "name":"first task",
      "description":"some fascinating description"
  }
  </code></pre>
  
  <p><strong>The repository:</strong></p>
  
  <pre><code>package mypackage.foo.core.jpa.repository;
  
  @Repository
  public interface TaskDao extends JpaRepository&lt;Task, Long&gt; {
  }
  </code></pre>
  
  <p><strong>The app configuration:</strong></p>
  
  <pre><code>@SpringBootApplication
  @EnableJpaRepositories(basePackages = {"mypackage.foo.core.jpa.repository"})
  @EntityScan(basePackages = {"mypackage.foo.core.jpa.domain"})
  public class FooApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(FooApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p><strong>Maven deps:</strong></p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jdbc&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
          &lt;artifactId&gt;lombok&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p><strong>My approach:</strong>
  The first idea was that it's been happening due to missing setter for <code>Id</code> in <code>Task</code>, but it didn't help. I've been wondering if I can get any hints how to solve this issue? 
  Any attempt to call <code>save(task)</code> is causing <code>IllegalStateException</code> to be thrown.</p>
  
  <p>The <code>save(Task task)</code> in <code>TaskService</code> is essentially calling the <code>taskDao.save(Task task)</code>.</p>
  
  <p>I was also suspecting the wrong <code>@Id</code> annotation (I mean from the wrong package), but it's not the case here.</p>