Я использую Java и Ibatis для вызова хранимой процедуры в базе данных Oracle.Кажется, у меня проблема с настройкой параметров.
Процедура сохранения выглядит следующим образом:
PROCEDURE Get_Semployees_By_Clt_ID
(
client_id IN HRIS.SEMPLOYEES.SEE_CLT_ID%TYPE,
ref_cursor OUT SYS_REFCURSOR
);
My Ibatis SqlMap:
<sqlMap namespace="Foo">
<resultMap id="employee-map" class="MyFoo">
<result property="foo1" column="foo1"/>
<result property="foo2" column="foo2"/>
</resultMap>
<parameterMap id="clientEmployeesParms" class="java.util.Map" >
<parameter property="in1" jdbcType="INTEGER" javaType="java.lang.Integer" mode="IN"/>
<parameter property="output1" jdbcType="ORACLECURSOR" javaType="java.sql.ResultSet" mode="OUT" />
</parameterMap>
<procedure id="clientEmployees" parameterMap="clientEmployeesParms" resultMap="employee-map">
{ call Package.Get_Clt_ID(?,?) }
</procedure>
</sqlMap>
Моя Java:
resource = "SqlMapConfig.xml";
reader = Resources.getResourceAsReader (resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
Map map = new HashMap();
map.put("in1", new Integer(23));
list = sqlMap.queryForList("Foo.clientEmployees", map);
Ошибка:
--- The error occurred while applying a parameter map.
--- Check the Employee.clientEmployeesParms.
--- Check the output parameters (retrieval of output parameters failed).
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:610)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:78)
at com.apache.struts.employee.model.IbatisStoredProcedure.main(IbatisStoredProcedure.java:30)