Skip to content

Commit

Permalink
Fix update with null values
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarota committed Sep 25, 2024
1 parent 1c96640 commit b569e7d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.ascendix.jdbc.salesforce.delegates;

import static java.lang.String.CASE_INSENSITIVE_ORDER;

import com.ascendix.jdbc.salesforce.metadata.Column;
import com.ascendix.jdbc.salesforce.metadata.Table;
import com.ascendix.jdbc.salesforce.utils.FieldDefTree;
Expand All @@ -23,8 +25,7 @@ public class PartnerService {
private final PartnerConnection partnerConnection;

private static DescribeGlobalResult schemaCache;
private static final Map<String, DescribeSObjectResult> sObjectsCache = new ConcurrentSkipListMap<>(
java.lang.String.CASE_INSENSITIVE_ORDER);
private static final Map<String, DescribeSObjectResult> sObjectsCache = new ConcurrentSkipListMap<>(CASE_INSENSITIVE_ORDER);

public PartnerService(PartnerConnection partnerConnection) {
this.partnerConnection = partnerConnection;
Expand Down Expand Up @@ -317,7 +318,11 @@ public SaveResult[] saveRecords(String entityName, List<Map<String, Object>> rec
SObject rec = records[i] = new SObject();
rec.setType(entityName);
for (Map.Entry<String, Object> field : recordDef.entrySet()) {
rec.setField(field.getKey(), field.getValue());
if (field.getValue() == null ) {
rec.setFieldsToNull(new String[] {field.getKey()});
} else {
rec.setField(field.getKey(), field.getValue());
}
}
}
// Make a create call and pass it the array of sObjects
Expand Down

0 comments on commit b569e7d

Please sign in to comment.