0

This is the call in the ProductServices.xml

<update id="resetPassword" parameterType="batchReport">
 { call user_account_mng.enc_reset_password(
       #{user_Id,jdbcType=VARCHAR,mode=IN},
   #{encrypted_password,jdbcType=VARCHAR,mode=IN},
   #{usr_id, dbcType=VARCHAR,mode=IN},
    #{salt,jdbcType=VARCHAR,mode=IN},
   #{ret_code,jdbcType=CHAR,mode=OUT},
   #{pgp_encrypted_password,jdbcType=BLOB,mode=IN}
)}

Now BatchReport is a POJO: (i have declared an alias for it as batchReport)

 public class BatchReport 
 {
private String user_Id;
private String encrypted_password;
private String usr_id;
private String salt;
private String ret_code;
private byte[] pgp_encrypted_password;
public String getUser_Id() {
    return user_Id;
}
public void setUser_Id(String user_Id) {
    this.user_Id = user_Id;
}
public String getEncrypted_password() {
    return encrypted_password;
}
public void setEncrypted_password(String encrypted_password) {
    this.encrypted_password = encrypted_password;
}
public String getUsr_id() {
    return usr_id;
}
public void setUsr_id(String usr_id) {
    this.usr_id = usr_id;
}
public String getSalt() {
    return salt;
}
public void setSalt(String salt) {
    this.salt = salt;
}
public String getRet_code() {
    return ret_code;
}
public void setRet_code(String ret_code) {
    this.ret_code = ret_code;
}
public byte[] getPgp_encrypted_password() {
    return pgp_encrypted_password;
}
public void setPgp_encrypted_password(byte[] pgp_encrypted_password) {
    this.pgp_encrypted_password = pgp_encrypted_password;
}

}

My main class is like this :

 <BatchReport batchReport = new BatchReport();
   byte[] byteArray =new byte[]{1,2,3};
   batchReport.setUser_Id("CHI");
   batchReport.setEncrypted_password("97D6B45"); 
   batchReport.setSalt("71L");
   batchReport.setPgp_encrypted_password(byteArray);
   String returnCode = productServiceObj.resetPassword(batchReport);

i am getting following error: Error setting null parameter. Most JDBC drivers require that the JdbcType must be specified for all nullable parameters. Cause: java.sql.SQLException: Invalid column type

The error may involve com.example.services.ProductServices.resetPassword-Inline

ProductServices is a class in which the method resetPassword is declared. Please help me with this BLOB issue. What should be the jdbcType in the called procedure. what value should be passed in this pgp_encrypted_password.

4

1 回答 1

0

好的,我找到了问题的解决方案,现在 .xml 文件中的查询中的 jdbcType 保持不变,即 BLOB。接下来为传入值设置的类型是 byte[]。

所以一切都和我掩盖的一样。实际上存在错误,因为 .xml 文件返回一个整数,指示查询中更改的行数,并且我已将函数返回类型指定为 String,所以这里解决了它应该是 Object 类型的问题。

于 2013-08-14T07:49:40.853 回答