title: Spring Boot: Type cannot be null; nested exception is java.lang.IllegalArgumentException: Type cannot be null when running Stored Procedue
body: <p>Good morning, I am new to Spring Boot, and I am performing a rest service that must invoke a procedure stored in the database, the question is that you receive the mobile and must return a code and result, as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/MbPb4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbPb4.png" alt="enter image description here"></a></p>
  
  <p>This is my code:</p>
  
  <p>Main Class</p>
  
  <pre><code>package com.app.validacion;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class App {
  
      public static void main(String[] args) {
          SpringApplication.run(App.class, args);
      }
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>package com.app.validacion.controller;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RestController;
  
  
  import com.app.validacion.dao.DriverBonificadosRepository;
  import com.app.validacion.entity.RespuestaVo;
  
  @RestController
  public class DriverBonificadosController {
  
      @Autowired
      private DriverBonificadosRepository dao;
  
      @GetMapping("/service/{movil}")
      public RespuestaVo  ConsultarMovil(@PathVariable String movil) {
          return dao.validarClienteBonifiado(movil);
  
      }
  }
  </code></pre>
  
  <p>Repository</p>
  
  <pre><code>package com.app.validacion.dao;
  
  import org.springframework.data.jpa.repository.query.Procedure;
  import org.springframework.data.repository.CrudRepository;
  
  import com.app.validacion.entity.DriverBonificados;
  import com.app.validacion.entity.RespuestaVo;
  
  public interface DriverBonificadosRepository extends CrudRepository&lt;DriverBonificados, Integer&gt; {
  
      @Procedure(procedureName="ValidacionClienteBonificado")
      RespuestaVo validarClienteBonifiado(String pMovil);
  }
  </code></pre>
  
  <p>My entity</p>
  
  <pre><code>import javax.persistence.NamedStoredProcedureQueries;
  import javax.persistence.NamedStoredProcedureQuery;
  import javax.persistence.ParameterMode;
  import javax.persistence.StoredProcedureParameter;
  import javax.persistence.Table;
  
  
  @NamedStoredProcedureQueries({
      @NamedStoredProcedureQuery(
              name="SPValidationClienteBonus4G",
              procedureName="ValidacionClienteBonificado",
              parameters = {
                      @StoredProcedureParameter(mode=ParameterMode.IN, name="p_movil",type=String.class), 
                      @StoredProcedureParameter(mode=ParameterMode.OUT, name="code",type=String.class),
                      @StoredProcedureParameter(mode=ParameterMode.OUT, name="result",type=String.class),
              })
  
  })
  
  @Entity
  @Table
  public class DriverBonificados {
  
      @Id
      private int id;
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getMovil() {
          return movil;
      }
      public void setMovil(String movil) {
          this.movil = movil;
      }
      public String getContador() {
          return contador;
      }
      public void setContador(String contador) {
          this.contador = contador;
      }
      public Date getFecha_driver() {
          return fecha_driver;
      }
      public void setFecha_driver(Date fecha_driver) {
          this.fecha_driver = fecha_driver;
      }
      public Date getFecha_alta() {
          return fecha_alta;
      }
      public void setFecha_alta(Date fecha_alta) {
          this.fecha_alta = fecha_alta;
      }
      public Date getFecha_fin() {
          return fecha_fin;
      }
      public void setFecha_fin(Date fecha_fin) {
          this.fecha_fin = fecha_fin;
      }
      public Date getCodigo_transaccion() {
          return codigo_transaccion;
      }
      public void setCodigo_transaccion(Date codigo_transaccion) {
          this.codigo_transaccion = codigo_transaccion;
      }
      private String movil;
      private String contador;
      private Date fecha_driver;
      private Date fecha_alta;
      private Date fecha_fin;
      private Date codigo_transaccion;
  </code></pre>
  
  <p>My Class RespuestaVo</p>
  
  <pre><code>package com.app.validacion.entity;
  
  public class RespuestaVo {
  
      private String code;
      private String result;
  
      public String getCode() {
          return code;
      }
      public void setCode(String code) {
          this.code = code;
      }
      public String getResult() {
          return result;
      }
      public void setResult(String result) {
          this.result = result;
      }
  
  }
  </code></pre>
  
  <p>And I get the following error (the mobile parameter must be received as a String, since in the database it is found as Varchar):</p>
  
  <p><a href="https://i.stack.imgur.com/FamnZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FamnZ.png" alt="enter image description here"></a></p>
  
  <p>Anyone have an idea how this problem could be solved? I need to consult via Stored Procedue if or if</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Using @Query and modifying the code as follows:</p>
  
  <pre><code>package com.app.validacion.dao;
  
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.jpa.repository.query.Procedure;
  import org.springframework.data.repository.CrudRepository;
  import org.springframework.data.repository.query.Param;
  
  import com.app.validacion.entity.DriverBonificados;
  import com.app.validacion.entity.RespuestaVo;
  
  public interface DriverBonificadosRepository extends CrudRepository&lt;DriverBonificados, Integer&gt; {
  
      @Query(nativeQuery = true,value = "call ValidacionClienteBonificado(:movil)")
      RespuestaVo validarClienteBonifiado(@Param("movil") String pMovil);
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>org.springframework.core.convert.ConverterNotFoundException: No
    converter found capable of converting from type
    [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap]
    to type [com.app.validacion.entity.RespuestaVo]   at
    org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
    ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]    at
    org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
    ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]    at
    org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174)
    ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]    at
    org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:297)
    ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
    org.springframework.data.repository.query.ResultProcessor$ChainingConverter.lambda$and$0(ResultProcessor.java:217)
    ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
    org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:228)
    ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
    org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:170)
    ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
    org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:157)
    ~[spring-data-jpa-2.2.1.RELEASE.jar:2.2.1.RELEASE]</p>
  </blockquote>