找到了解决办法,参见下文*
我试图执行一个存储功能,通过SimpleJdbcCall时(使用Java + JPA),但我不能执行,它表明:
[Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException:
CallableStatementCallback; uncategorized SQLException for SQL [{? = call PK_BACKOFFICE.SET_PROFESSIONAL(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}];
SQL state [null]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type] with root cause
java.sql.SQLException: Invalid column type
这里是我的代码:
dataSource = this.getDataSource();
SimpleJdbcCall caller = new SimpleJdbcCall(dataSource)
.withCatalogName("pk_backoffice_api_ui")
.withFunctionName("set_professional_main")
.declareParameters(
new SqlOutParameter("result",OracleTypes.BOOLEAN),
new SqlParameter("i_id_institution",
OracleTypes.NUMERIC),
new SqlParameter("i_id_prof", OracleTypes.NUMERIC),
new SqlParameter("i_first_name", OracleTypes.VARCHAR),
new SqlParameter("i_nick_name", OracleTypes.VARCHAR),
new SqlParameter("i_gender", OracleTypes.VARCHAR),
new SqlParameter("i_id_category", OracleTypes.NUMERIC),
new SqlParameter("i_id_lang", OracleTypes.NUMERIC),
new SqlParameter("i_flg_state", OracleTypes.VARCHAR),
new SqlParameter("i_commit_at_end", OracleTypes.BOOLEAN),
new SqlOutParameter("o_id_prof", OracleTypes.INTEGER),
new SqlOutParameter("o_error", OracleTypes.STRUCT, "T_ERROR_OUT"));
MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("i_id_institution", 2790)
.addValue("i_id_prof", 7020000363724L)
.addValue("i_first_name", "teste")
.addValue("i_nick_name", "nicknameteste")
.addValue("i_gender", "f").addValue("i_id_category", 20)
.addValue("i_id_lang", 1).addValue("i_flg_state", "A")
.addValue("i_commit_at_end", true);
Integer res = caller.executeFunction(Integer.class, params);
Map out = caller.execute(params);
int idprof = (int) out.get("o_id_prof"); //getting out parameter?
// para obter o erro - caso haja
// (com.alert.core.plsql.types.TErrorOutType)__sJT_st.getORAData(35,com.alert.core.plsql.types.TErrorOutType.getORADataFactory());
System.out.println(res);
return res;
}
我意识到这个问题是发送/接收布尔的功能 。我还发现这是JDBC驱动程序的问题...有没有在BD编辑类型的选项,所以我真的需要找到一种方法发送/接收布尔值。
..有什么建议么?