如何使用 spring 引导数据映射 cassandra 中的用户数据类型

How to map user data type in cassandra using spring boot data

我正在寻找与使用 Cassandra 数据库的 spring 引导数据相关的帮助。
我的 pom.xml.

中有以下依赖项
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-boot-starter-data-cassandra</artifactId>
        </dependency>

        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>2.1.10.3</version>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-mapping</artifactId>
            <version>2.1.10.3</version>
        </dependency>

The table structure looks like:

@Table(value = "TEST_ORDERS")
public class OrderDTO {

    @PrimaryKey
    @Column(value = "email")
    private String emailId;

    @Column(value = "order_id")
    private int orderId;

    @Column(value = "creation_date")
    private Timestamp creationDate;

    @Column(value = "discount_total")
    private double discountTotal;

    @Column(name = "shipments")
    //This is a UDT type
    private Set<ShippingDetails> shipments;

    //getters and setters here
}

The ShippingDetails object is a UDT with following declartion and i defined as a frozen collection in the cassandra CQL sripts

@UDT(name = "shipping", keyspace = "mc_checkout")
public class ShippingDetails {

    @Field(name = "name")
    private FullName name;

    @Field(name = "quantity_shipped")
    private int quantityShipped;

    @Field(name = "shipping_address")
    private CheckoutAddress shippingAddress; 
    //so on
}

There is a repository created for the basic CRUD operations:
@Repository
public interface OrderRepository extends CrudRepository<OrderDTO, String> {

}

    When i try to invoke findOne API of this repository in my Service class 

我得到以下错误: Cassandra 实体必须具有 @Table、@Persistent 或 @PrimaryKeyClass Annotation

Spring Apache Cassandra 的数据和 Datastax 的映射是两个独立的工具,它们试图完成相同的任务。请使用任何一种,但不要混用。

CrudRepository 是 Spring 数据类型,而 @Field@UDT 来自 Datastax 映射。

UDT 对 Spring Apache Cassandra 数据的支持从版本 1.5 开始可用,请参阅 reference docs。 Spring Apache Cassandra 1.5 的数据需要 Datastax Java Driver 3.0 或更新版本。