我需要使用注解在MyBatis中调用Oracle函数。使用MyBatis调用oracle函数(基于注释)
我的映射:
@Select("{ CALL #{outParam, jdbcType=NUMERIC, mode=OUT} := ORA_FUNC("
+ "#{pNum1, jdbcType=NUMERIC, mode=IN},"
+ "#{pNum2, jdbcType=NUMERIC, mode=IN},"
+ "#{pNum3, jdbcType=NUMERIC, mode=IN})}")
@Options(statementType = StatementType.CALLABLE)
@ResultType(Integer.class)
public Integer executeFunction(
@Param("map") Map<String, Object> carteira);
我呼吁这个签名:
Map<String, Object> mapParameters = new HashMap<String, Object>();
mapParameters.put("pNum1", carteira.getUnimedCarteira());
mapParameters.put("pNum2", carteira.getCodCarteira());
mapParameters.put("pNum3", carteira.getDigitoCarteira());
mapper.obterRedeBeneficiario(mapParameters);
return mapParameters.get("outParam").toString();
的outParam为null,并且映射器的返回是空过。
任何人都可以帮助我吗?
你可以参考http://stackoverflow.com/questions/26739636/mybatis-mapping- for-fetching-list-of-custom-record-types-in-oracle/26765161#26765161增加了一个完整的例子 – 2014-11-05 19:11:44
Karthik,这个例子是基于XML的,我尝试在基于注释的位类似工作 – mEstrazulas 2014-11-05 23:56:41
你能告诉我们吗你做了什么改变? – 2014-11-06 05:13:12