Cassandra Datastax驱动程序在访问器上设置分页状态 [英] Cassandra Datastax Driver set paging state on Accessor
问题描述
我正在为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);
然后从那里调用 setPagingState
Statement
返回并执行。
And then from there you call setPagingState
on the Statement
returned and execute it.
我同意这并不像向Accessor提供分页状态作为参数那样好,所以我继续打开 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屋!