2015-02-06 84 views

回答

0

你可以做到這一點與ReplacementDataSet

下面是一個例子:

表模式:

CREATE TABLE TABLE_CLOB(COLUMN_CLOB CLOB); 

XML數據集(文件dataSet.xml):

<dataset> 
    <table name="TABLE_CLOB"> 
     <column>COLUMN_CLOB</column> 
     <row> 
     <value>CLOB_1</value> 
     </row> 
    </table> 
</dataset> 

在你的測試方法:

// Initialize one IDataSet from your dataset xml 
InputStream expIn = this.getClass().getResourceAsStream("dataSet.xml"); 
IDataSet xmlDataSet = new XmlDataSet(expIn); 

// Initialize one ReplacementDataSet with previous xmlDataSet 
ReplacementDataSet dataSet = new ReplacementDataSet(xmlDataSet); 

// Make the replacements 
dataSet.addReplacementObject("CLOB_1", YourClobObject); 

// Insert the dataSet into the databaseTest 
DatabaseOperation.CLEAN_INSERT.execute(databaseTester.getConnection(), dataSet); 

希望它有幫助