MeasureMapper mapper = session.getMapper(MeasureMapper.class);
for (MeasureModel value : values) {
- mapper.insert(value);
+ mapper.batchInsert(value);
}
session.commit();
MeasureMapper mapper = session.getMapper(MeasureMapper.class);
for (MeasureModel value : values) {
- mapper.insert(value);
+ mapper.batchInsert(value);
mapper.insertData(value);
}
public interface MeasureMapper {
void insert(MeasureModel measure);
+ void batchInsert(MeasureModel measure);
+
void insertData(MeasureModel data);
void update(MeasureModel measure);
)
</insert>
- <insert id="insertData" parameterType="MeasureModel" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="batchInsert" parameterType="MeasureModel" useGeneratedKeys="false">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select project_measures_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO project_measures (id,
+ value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
+ project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
+ variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
+ VALUES (#{id},
+ #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
+ #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+ #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
+ #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
+ )
+ </insert>
+
+ <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="false">
<selectKey order="BEFORE" resultType="Long" keyProperty="id">
select measure_data_seq.NEXTVAL from DUAL
</selectKey>
)
</insert>
- <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="true" keyProperty="id">
+ <insert id="batchInsert" parameterType="MeasureModel" useGeneratedKeys="false">
+ INSERT INTO project_measures (
+ value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
+ project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
+ variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
+ VALUES (
+ #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
+ #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+ #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
+ #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
+ )
+ </insert>
+
+ <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="false">
INSERT INTO measure_data (measure_id, snapshot_id, data)
VALUES (#{measureData.measure.id}, #{snapshotId}, #{measureData.data})
</insert>