Wednesday, May 27, 2009

Generic iBatis Error in Huge Volume Cetric Data

Error
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the BillIe.insertBillIssuingEntityOnEditCycle-InlineParameterMap.
--- Check the statement (update procedure failed).
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 1:
PLS-00123: program too large (Diana nodes)

Solution:

Step 1: Create a store procedure which would insert/delete record from table

Step 2: Define some threshold value (Note: you must be ensure that threshold value won't encounter Diana nodes kind of problem) in java.

Step 3: Push records in batch mode

Pseudo Code Snippet


getSqlMapClient().startTransaction()
getSqlMapClient().startBatch()

//Check out how many records are there in the modelMap or List

totalRecord = modelList.size

toIndex = modelList.size

fromIndex =0

numberOfLoops = new Double(Math.ceil(totalRecord / THRESHOLD_VALUE)).intValue()

if(THRESHOLD_VALUE <= toIndex){
toIndex = new Double(THRESHOLD_VALUE).intValue()
}

for(int i = 0; i <>

modelSubList = modelList.subList(fromIndex , toIndex)

getSqlMapClient().insert("sql-map-id", modelSubList )

modelList.subList(fromIndex, toIndex).clear()

if(modelList.size() < THRESHOLD_VALUE){
toIndex = modelList.size();
}

}

getSqlMapClient().executeBatch()
getSqlMapClient().commitTransaction()

No comments:

Post a Comment