2017-02-21 55 views
1

试图在下面的链接中调整我的解决方案以处理CLOB OUT参数。 returnType将用于处理oracle clobs是什么?除了吊球处理之外,我没有在文档中看到它的引用。针对Oracle Clobs的存储过程OutBound Gateway返回类型?

Previous Question - Handling OUT Array Params

<bean id="clobSqlReturnType" class=org.springframework.integration.jdbc.storedproc.?></bean> 


<int-jdbc:stored-proc-outbound-gateway 
    id="outbound-gateway-function-dbms" request-channel="procedureDBMSRequestChannel" 
    data-source="dataSource" 
    is-function="true" 
    stored-procedure-name="get_dbms_output2" 
    expect-single-result="true"> 
    <int-jdbc:sql-parameter-definition name="c1" type="CLOB" type-name="" direction="OUT" return-type="clobSqlReturnType" />  
</int-jdbc:stored-proc-outbound-gateway> 

回答

0

有出的现成无解。你应该自己做点什么。像这样:

public class ClobSqlReturnType implements SqlReturnType { 

    @Override 
    public Object getTypeValue(CallableStatement cs, int paramIndex, int sqlType, String typeName) throws SQLException { 
     Clob clob = cs.getClob(paramIndex); 
     return clob != null ? clob.getSubString(1, (int) clob.length()) : null; 
    } 
} 
+0

感谢这就是我的想法。我看到了使用它的代码示例的网关测试过程,并不确定它是否不是已经存在的某种类型的代码。 – haju