2017-02-21 54 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