Insert should include both mutated and primary key components (partition keys and clustering columns) otherwise it's invalid CQL.

This commit is contained in:
Greg Burd 2017-10-11 15:15:59 -04:00
parent 605529979d
commit 4e461c1be0

View file

@ -83,9 +83,18 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
Set<String> 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);