cassandra driver 3.0(Java)中用户定义类型的QueryBuilder

cassandra driver 3.0(Java)中用户定义类型的QueryBuilder,java,cassandra,cql,cql3,Java,Cassandra,Cql,Cql3,我有一个模式如下 CREATE TABLE location_by_name( id uuid, coordinates frozen<coords>, name text, primary key (name) ); CREATE TYPE coords( longitude double, latitude double ); 按名称创建表位置\u( id uuid, 坐标冻结, 名称文本, 主键(名称) ); 创建类型坐标( 经度加倍, 双纬度 ); 我可以使用预先准备

我有一个模式如下

CREATE TABLE location_by_name(
id uuid,
coordinates frozen<coords>,
name text,
primary key (name)
);

CREATE TYPE coords(
longitude double, 
latitude double
);
按名称创建表位置\u(
id uuid,
坐标冻结,
名称文本,
主键(名称)
);
创建类型坐标(
经度加倍,
双纬度
);
我可以使用预先准备好的语句插入数据,但我无法使用QueryBuilderAPI来完成,如果有人能为我指出正确的方向,那就太好了


谢谢

这应该可以做到:

UserType coordsType = cluster.getMetadata()
     .getKeyspace("ks")
     .getUserType("coords");
UDTValue coordinates = coordsType.newValue()
    .setDouble("longitude", 2.35)
    .setDouble("latitude", 48.853);
Statement insert = QueryBuilder.insertInto("location_by_name")
    .value("id", id)
    .value("coordinates", coordinates)
    .value("name", name);

这应该可以做到:

UserType coordsType = cluster.getMetadata()
     .getKeyspace("ks")
     .getUserType("coords");
UDTValue coordinates = coordsType.newValue()
    .setDouble("longitude", 2.35)
    .setDouble("latitude", 48.853);
Statement insert = QueryBuilder.insertInto("location_by_name")
    .value("id", id)
    .value("coordinates", coordinates)
    .value("name", name);

这就是为什么我们使用Spring数据Cassandra不处理这个残酷的样板文件,这就是为什么我们使用Spring数据Cassandra不处理这个残酷的样板文件