Skip to content

Commit

Permalink
TEIID-5060: Avoid the update to the PK column, as this leads to wrong…
Browse files Browse the repository at this point in the history
… data interms of book keeping (#1004)
  • Loading branch information
rareddy committed Sep 14, 2017
1 parent 5d36ce5 commit 3262a5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Expand Up @@ -46,6 +46,7 @@ public static enum Event implements BundleUtil.Event{
TEIID25015,
TEIID25016,
TEIID25017,
TEIID25018
TEIID25018,
TEIID25019
}
}
Expand Up @@ -158,8 +158,9 @@ public void run(Object row) throws TranslatorException {
@Override
public void run(Object row) throws TranslatorException {
InfinispanDocument previous = (InfinispanDocument)row;
Object key = previous.getProperties().get(PK);
int count = previous.merge(visitor.getInsertPayload());
cache.replace(previous.getProperties().get(PK), previous);
cache.replace(key, previous);
updateCount = updateCount + count;
}
}, this.executionContext.getBatchSize());
Expand Down
Expand Up @@ -282,13 +282,17 @@ public void visit(Update obj) {
if (!table.equals(getParentTable())) {
this.nested = true;
}

// read the properties
try {
InfinispanDocument targetDocument = buildTargetDocument(table, false);
int elementCount = obj.getChanges().size();
for (int i = 0; i < elementCount; i++) {
Column column = obj.getChanges().get(i).getSymbol().getMetadataObject();
if (isPartOfPrimaryKey(column.getName())) {
throw new TranslatorException(InfinispanPlugin.Event.TEIID25019,
InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25019, column.getName()));
}
Expression expr = obj.getChanges().get(i).getValue();
Object value = resolveExpressionValue(expr);
//this.updatePayload.put(getName(column), value);
Expand Down
Expand Up @@ -40,3 +40,4 @@ TEIID25015=Invalid entry in teiid-alias-naming-cache. The key {0} has invalid va
TEIID25016=Unknown command is being executed using the direct query procedure. {0}
TEIID25017=Bulk Insert operation is not supported on table {0}, because this structure is a nested document in parent table {1}
TEIID25018=Bulk Upsert operation is not supported currently.
TEIID25019=With Infinispan, since records are stored using the primary key, updating that column is not supported. So, can not update "{0}" column. You can alternatively delete and re-insert the row.

0 comments on commit 3262a5e

Please sign in to comment.