I have a Mapper class like this in my Application tha is trying to call a procedure in the database, and i checked like 3000 times the the type and positios og the parameters are right, but it throws and sqlException, now i will show you the Code of the Mapper
@Mapper
public interface HoraFechaExtractoMapper {
@Select(value="{ CALL PACKAGE.PROCEDURE("
"#{P_tpno, mode=IN, jdbcType=VARCHAR},"
"#{Registro.pPeriodicidad, mode=OUT, jdbcType=VARCHAR},"
"#{Registro.pHora, mode=OUT, jdbcType=VARCHAR},"
"#{Registro.pDia, mode=OUT, jdbcType=NUMERIC})}")
public void getHoraFechaExtracto(@Param("P_tpno") String p_tpno,@Param("Registro") Registro registro);
}
and My Registro Class that is a Parameter for the methos Mapper is like this
public class Registro implements Serializable{
/**
*
*/
private static final long serialVersionUID = 2014497735552490495L;
/** The p periodicidad. */
@JsonProperty("p_periodicidad")
private String pPeriodicidad;
/** The p hora. */
@JsonProperty("p_hora")
private String pHora;
/** The p dia. */
@JsonProperty("p_dia")
private Integer pDia;
/**
* Gets the p periodicidad.
*
* @return the p periodicidad
*/
public String getpPeriodicidad() {
return pPeriodicidad;
}
/**
* Sets the p periodicidad.
*
* @param pPeriodicidad the new p periodicidad
*/
public void setpPeriodicidad(String pPeriodicidad) {
this.pPeriodicidad = pPeriodicidad;
}
/**
* Gets the p hora.
*
* @return the p hora
*/
public String getpHora() {
return pHora;
}
/**
* Sets the p hora.
*
* @param pHora the new p hora
*/
public void setpHora(String pHora) {
this.pHora = pHora;
}
/**
* Gets the p dia.
*
* @return the p dia
*/
public Integer getpDia() {
return pDia;
}
/**
* Sets the p dia.
*
* @param pDia the new p dia
*/
public void setpDia(Integer pDia) {
this.pDia = pDia;
}
}
But when Mybatis is preparing the statement it throws this error
### The error occurred while setting parameters
### SQL: { CALL PACKAGE.PROCEDURE(?,?,?,?)}
### Cause: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
Caused by: org.apache.ibatis.exceptions.PersistenceException:
It is very likely that the error is in the mapper, but i can't find the error, maybe you could see it
CodePudding user response:
maybe you need
@Options(statementType = StatementType.CALLABLE)
after Select annotation