title: How to send a Java Long value from json
body: <p>I'm trying to send a POST request to an Spring RestController with a request body. In the object there is a Long value but it is not arriving to the endpoint with the other parameters.
  The class used as <code>@RequestBody</code> is this one:</p>
  
  <pre><code>@Entity
  public class Curso {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "id")
      private Long id;
      @Column(name = "titulo")
      private String titulo;
      @Column(name = "nivel")
      private String nivel;
      @Column(name = "nhoras")
      private String nhoras;
      @Column(name = "profesorid")
      private Long profesorid;
      [...]
      public Long getProfesorid() {
          return profesorid;
      }
      public void setProfesorid(Long profesor) {
          this.profesorid = profesorid;
      }
  }
  </code></pre>
  
  <p>The endpoint in the class annotated with <code>@RestController</code>, is this:</p>
  
  <pre><code>    @RequestMapping(value = "/crear-curso", method = RequestMethod.POST)
      public void addCurso(@RequestBody Curso curso) {
          cursoService.addCurso(curso);
      }
  </code></pre>
  
  <p>And this is the JSON I'm using in the body of the POST request:</p>
  
  <pre><code>{
      "titulo": "Git",
      "nivel": "Intermedio",
      "nhoras": "12",
      "profesorid": 1581068174
  }
  </code></pre>
  
  <p>All the other parameters are arriving correctly and the object arrives to the database, but with the <code>profesorid</code> with <em>null</em> value. I stopped the execution y this <em>addCurso</em> method and the value of <em>profesorid</em> is null. The <em>id</em> value is not being sent in the request because it is setted before saving in the database.
  Please, anyone can help me and say what is failing here? Many thanks in advance.</p>