title: The method getId() is undefined for the type ClassName
body: <p>I am learning Spring boot and got stuck in a problem. I have created an Expense class as following:</p>
  
  <pre><code>    @AllArgsConstructor
  @NoArgsConstructor
  @Entity
  @Data
  @Table(name="expense")
  public class Expense {
      @Id
      private Long id;
  
      private Instant expensedate;
  
      private String description;
  
      private String location;
  
      @ManyToOne
      private Category category;
  
      @JsonIgnore
      @ManyToOne
      private User user;
  }
  </code></pre>
  
  <p>Now I am trying to create a controller to add/delete the Expense objects. Following method is for creating Expense object:</p>
  
  <pre><code>@PostMapping("/expenses")
  ResponseEntity&lt;Expense&gt; createExpense(@Valid @RequestBody Expense expense) throws URISyntaxException{
      Expense result = expenseRepository.save(expense);
      return ResponseEntity.created(new URI("/api/expense" + result.getId())).body(result);
  }
  </code></pre>
  
  <p>But here in this method I am getting following error:</p>
  
  <blockquote>
    <p>The method getId() is undefined for the type Expanse</p>
  </blockquote>