Cassandra Datastax 驱动程序在访问器上设置分页状态 [英] Cassandra Datastax Driver set paging state on Accessor

查看:19
本文介绍了Cassandra Datastax 驱动程序在访问器上设置分页状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 cassandra 使用 Datastax 可爱的 Java 驱动程序.我试图将所有查询字符串封装到用于映射的内置访问器中,但我需要能够为查询设置分页状态.

I'm using Datastax's lovely java driver for cassandra. I was trying to encapsulate all of my query strings into the built in accessors for mapping, but I require the ability to set the paging state for a query.

我看到使用普通语句 (SimpleStatement) 可以做到这一点,但我还没有找到访问器的相应功能.它是否存在,或者我是否跳过使用访问器来实现此功能?

I see that this is possible with a normal Statement (SimpleStatement), but I haven't found the corresponding functionality for an Accessor. Does it exist, or do I have skip using Accessors for this functionality?

推荐答案

我同意这真的很好.

目前处理此问题的一种方法是让您的访问者返回一个声明,即:

One way to work with this for now would be to have your accessor return a Statement, i.e.:

@Query("SELECT * FROM ks.tbl WHERE id = ?")
Statement getAllById(@Param("id") UUID userId);

然后在返回的 Statement 上调用 setPagingState 并执行它.

And then from there you call setPagingState on the Statement returned and execute it.

我同意这不如提供分页状态作为访问器的参数那么好,所以我继续打开了 JAVA-1103.

I agree that this isn't as nice as providing the paging state as a parameter to the Accessor, so I went ahead and opened up JAVA-1103.

这篇关于Cassandra Datastax 驱动程序在访问器上设置分页状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆