我在我的應用程式中有一個這樣的 Mapper 類,我試圖呼叫資料庫中的一個程序,我檢查了 3000 次型別和位置 og 引數是正確的,但它拋出了 sqlException,現在我將向您展示映射器代碼
@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);
}
和作為方法映射器引數的我的注冊類是這樣的
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;
}
}
但是當 Mybatis 在準備陳述句時,它拋出這個錯誤
### 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:
錯誤很可能出在映射器中,但是我找不到錯誤,也許您可??以看到它
uj5u.com熱心網友回復:
也許你需要
@Options(statementType = StatementType.CALLABLE)
選擇注解后
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/384503.html
上一篇:SpringKafkaKafkaListener注釋是否能夠將配置屬性作為主題名稱?
下一篇:JPA清除快取以讀取一項
