From 4e461c1be046fc972104f89b7277abdd0165fa25 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Wed, 11 Oct 2017 15:15:59 -0400 Subject: [PATCH] Insert should include both mutated and primary key components (partition keys and clustering columns) otherwise it's invalid CQL. --- .../net/helenus/core/operation/InsertOperation.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/helenus/core/operation/InsertOperation.java b/src/main/java/net/helenus/core/operation/InsertOperation.java index 3ee0c8a..53abaee 100644 --- a/src/main/java/net/helenus/core/operation/InsertOperation.java +++ b/src/main/java/net/helenus/core/operation/InsertOperation.java @@ -83,9 +83,18 @@ public final class InsertOperation extends AbstractOperation keys = (mutations == null) ? null : mutations; for (HelenusProperty prop : properties) { + boolean addProp = false; - if (keys == null || keys.contains(prop.getPropertyName())) { + switch (prop.getColumnType()) { + case PARTITION_KEY: + case CLUSTERING_COLUMN: + addProp = true; + break; + default: + addProp = (keys == null || keys.contains(prop.getPropertyName())); + } + if (addProp) { Object value = BeanColumnValueProvider.INSTANCE.getColumnValue(pojo, -1, prop); value = sessionOps.getValuePreparer().prepareColumnValue(value, prop);