title: How to do an INSERT statement using JPA Repository
body: <p>I know that Jpa Repository provides the save() method in order to persist an object. But I want to do it myself, I am trying to insert something in a table but an error <code>"could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement"</code> appear in the POSTMAN response. This is my code</p>
  
  <p>My repository</p>
  
  <pre><code>    @Modifying
      @Query(value = "insert into TipoAcesso (accesTypeId,accessTypeName,subAcessTypeName,user_id) VALUES (:accesTypeId,Quarto,null,:user_id)",nativeQuery = true)
      @Transactional
      void insertAccesTypeQuartosToUser(@Param("user_id") Long userId);
  </code></pre>
  
  <p>My Controller</p>
  
  <pre><code>    @PostMapping(value = "/acessoCozinha")
      public ResponseEntity&lt;Response&lt;TipoAcesso&gt;&gt; insertAccessCozinha(HttpServletRequest request) {
  
          TipoAcesso tipoAcesso = new TipoAcesso();
          Response&lt;TipoAcesso&gt; response = new Response&lt;&gt;();
          try {  
              tipoAcesso.setUser(userFromRequest(request)); 
              tiposAcessoService.insertAccesTypeCozinhaToUser(tipoAcesso);
  
          }   catch (Exception e) {
              response.getErrors().add(e.getMessage());
              return ResponseEntity.badRequest().body(response);
          }
  
          return ResponseEntity.ok(response);
      }
  </code></pre>