Changeset 7124


Ignore:
Timestamp:
Apr 20, 2016, 8:12:54 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #2000: Batch API for annotation handling

Fixes a NullPointerException when updating and unit is null.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/AnnotationBatcher.java

    r7123 r7124  
    653653           
    654654            // Update last_update, unit, version in Annotations
    655             updateAnnotations.addToBatch(info.version+1, unit != null ? unit.getId() : info.unitId, batchDate, info.annotationId, info.version);
     655            if (unit != null) info.unitId = unit.getId();
     656            updateAnnotations.addToBatch(info.version+1, info.unitId, batchDate, info.annotationId, info.version);
    656657          }
    657658          else
     
    674675
    675676          // Insert into ParameterValues
    676           int valueId = insertIntoParameterValues.insert(discriminators[info.valueType.ordinal()]);
     677          info.valueId = insertIntoParameterValues.insert(discriminators[info.valueType.ordinal()]);
    677678         
    678679          // Insert into **Values
    679680          for (Object v : convertedValues)
    680681          {
    681             insertValues[info.valueType.ordinal()].addToBatch(valueId, v);
     682            insertValues[info.valueType.ordinal()].addToBatch(info.valueId, v);
    682683          }
    683684
     
    692693
    693694          // Insert into Annotations
    694           int annotationId = insertIntoAnnotations.insert(currentAnnotationSetId, info.annotationTypeId, null, valueId, batchDate);
     695          info.annotationId = insertIntoAnnotations.insert(currentAnnotationSetId, info.annotationTypeId, null, info.valueId, batchDate);
    695696        }
    696697      }
     
    704705    // the SnapshotManager to clear the cache when this
    705706    // batcher is closed
    706     if (changeType != Change.NO_CHANGE && deleteSnapshotIfModifed)
    707     {
    708       deleteSnapshotIfModifed = false;
    709       snapshotsToDelete.add(currentAnnotationSetId);
     707    if (changeType != Change.NO_CHANGE)
     708    {
     709      if (deleteSnapshotIfModifed)
     710      {
     711        deleteSnapshotIfModifed = false;
     712        snapshotsToDelete.add(currentAnnotationSetId);
     713      }
    710714    }
    711715   
     
    739743    */
    740744    DELETED;
     745   
    741746  }
    742747 
     
    778783  }
    779784 
    780  
    781785  /**
    782786    Batcher implementation for inserting into tables.
Note: See TracChangeset for help on using the changeset viewer.