cassandra 我正在尝试使用Datastax 4.2.2编写DAO接口,但遇到了几个编译错误

afdcj2ne  于 2022-11-05  发布在  Cassandra
关注(0)|答案(1)|浏览(115)

我有以下POJO:

@Table(name = "order", readConsistency = "QUORUM", writeConsistency = "QUORUM")
public class Order {    

    @Column(name = "id")
    @PartitionKey
    private String id;

    @Column(name = "customer_id")
    private String customerId;

    @Column(name = "loyalty_id")
    private String loyaltyId;

    @Column(name = "customer_email")
    private String customerEmail;

    public Order() {

    }
    ... getters and setters
}

现在我写的OrderDao如下:

import com.datastax.oss.driver.api.mapper.annotations.*;

    @Dao
    public interface OrderDao {
            @Select
            Order findById(String orderId);

            @Insert
            void save(Order order);

            @Delete
            void delete(Order order);
    }

当我执行./gradlew build时,我得到以下错误:
第一个
我将按照以下文档进行实施:https://docs.datastax.com/en/developer/java-driver/4.2/manual/mapper/。可能的原因是什么?

  • 谢谢-谢谢
xuo3flqw

xuo3flqw1#

Order类上缺少@Entity注解:

@Entity
@Table(name = "order", readConsistency = "QUORUM", writeConsistency = "QUORUM")
public class Order {

相关问题