I am trying to insert 1000 records into a table(Oracle DB) using mybatis as a batch opertaion(using ExecutorType.Batch in sqlsessionTemplate & <foreach>
tag in mapper xml).
While executing the mapper function to insert,if there is any error inbetween, it rollbacks completely, skipping the remaining batch insertion process.
Our requirement is to log the error for records whichever failing,and continue with the insertion of remaining records.
Is there any possibility/option available in mybatis-batch insert to achieve this.
Sample query used in mapper XML:
<insert id="addSampleBatch" parameterType='java.util.Map'>
INSERT ALL
<foreach collection="sampleList" item="vehicle">
INTO
vehicle
(id,name)
VALUES
(#{vehicle.id},
#{vehicle.name} )
</foreach>
SELECT * FROM dual
</insert>
myBatis version:3.2.8
mybatis-spring jar version:1.2.2