]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3437 Disable batch insert because it cannot work
authorDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 06:58:12 +0000 (08:58 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 07:04:59 +0000 (09:04 +0200)
sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java
sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureMapper.java
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper-oracle.xml
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml

index 34ae2758b413c1ae02d3f4702c058545be39168c..32730a2d990856b8bfb3f9de92bce0d7983b4d4d 100644 (file)
@@ -184,12 +184,12 @@ public final class MeasurePersister {
   }
 
   private void batchInsert(Iterable<MeasureModel> values) {
-    SqlSession session = mybatis.openBatchSession();
+    SqlSession session = mybatis.openSession();
     try {
       MeasureMapper mapper = session.getMapper(MeasureMapper.class);
 
       for (MeasureModel value : values) {
-        mapper.batchInsert(value);
+        mapper.insert(value);
       }
 
       session.commit();
@@ -204,7 +204,7 @@ public final class MeasurePersister {
       MeasureMapper mapper = session.getMapper(MeasureMapper.class);
 
       for (MeasureModel value : values) {
-        mapper.batchInsert(value);
+        mapper.insert(value);
         mapper.insertData(value);
       }
 
index bc73674425b640d21a9f6368868f73eb1333757d..5995096374796e839714c2053cc3265fa3d600ac 100644 (file)
@@ -22,8 +22,6 @@ package org.sonar.api.database.model;
 public interface MeasureMapper {
   void insert(MeasureModel measure);
 
-  void batchInsert(MeasureModel measure);
-
   void insertData(MeasureModel data);
 
   void update(MeasureModel measure);
index bac51609efe2e933de06ec105c18f8a508851960..ff9a77941aa22a921b89259970436bfd49df4f4b 100644 (file)
     )
   </insert>
 
-  <insert id="batchInsert" parameterType="MeasureModel" useGeneratedKeys="false">
-    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 (
-      project_measures_seq.NEXTVAL,
-      #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue}, #{tendency},
-      #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus}, #{alertText},
-      #{url}, #{description}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
-      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
-    )
-  </insert>
-
-  <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="false">
+  <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="true" keyProperty="id">
     INSERT INTO measure_data (id, measure_id, snapshot_id, data)
     VALUES (measure_data_seq.NEXTVAL, #{id}, #{snapshotId}, #{measureData.data})
   </insert>
index e4eb62d7310b32eee4d475855e98237d7320197e..9f155fdb17210ca1f9b6a98d9d51a2e1810435f8 100644 (file)
     )
   </insert>
   
-  <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}, #{tendency},
-      #{measureDate}, #{projectId}, #{alertStatus}, #{alertText},
-      #{url}, #{description}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
-      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
-    )
-  </insert>
-  
-  <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="false">
+  <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="true" keyProperty="id">
     INSERT INTO measure_data (measure_id, snapshot_id, data)
     VALUES (#{id}, #{snapshotId}, #{measureData.data})
   </insert>