In our Project we are using Quarkus Version 2.8.0.FINAL and Datastax Version 1.1.1 accessing cassandra database Version 3.11
Wa are getting the following Exception when we perform an insert via Java.
com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: PRIMARY KEY column "col_4" cannot be restricted as preceding column "col_3" is not restricted
We do not understand why that happens since the following statement executed via SQLTools from VSCode succeeds without any problem
INSERT INTO my_table (
col_1,
col_2,
col_3,
col_4,
col_5,
col_6,
col_7
)
VALUES (
'Some Value',
'5ea20642-e9e7-44bd-b4f0-97b84ae97f2c',
'1ed91e32-a7ba-4b5f-b4dd-9cfe3e522914',
'Another Value',
'2010-01-01',
'24afc036-21e8-41c6-9f7a-1994fba71223',
'Just one mor value'
);
Our Table is as follows
CREATE TABLE IF NOT EXISTS my_table (
col_1 text,
col_2 text,
col_3 text,
col_4 text,
col_5 text,
col_6 text,
col_7 date,
PRIMARY KEY(col_1, col_2, col_3, col_4)
);
The Entity
@Entity
@CqlName("my_entity")
public class MyEntity {
@PartitionKey
private String col_1;
@ClusterinColumn
private String col_2;
@ClusterinColumn(1)
private String col_3;
@ClusterinColumn(2)
private String col_4;
private String col_5;
private String col_6;
private LocalDate col_1;
}
The Dao
@Dao
public interface MyEntityDao {
@Insert
void insert (MyEntity myEntity)
}