如何在JAVA中以排序格式检索ApacheIgnite缓存的Cassandra表?

如何在JAVA中以排序格式检索ApacheIgnite缓存的Cassandra表?,ignite,Ignite,我使用spring引导代码从Cassandra表“test”加载数据。我已经定义了组索引并提到了持久性的顺序,但是当我试图使用“findAll()”方法获取所有记录时,数据并不是以排序的方式来的。 请让我知道我是否走错了路。因为我不确定如何以排序方式检索缓存表数据 卡桑德拉表: create table test(key int primary key, city text, location text, subscribers int); java对象: public class Test

我使用spring引导代码从Cassandra表“test”加载数据。我已经定义了组索引并提到了持久性的顺序,但是当我试图使用“findAll()”方法获取所有记录时,数据并不是以排序的方式来的。 请让我知道我是否走错了路。因为我不确定如何以排序方式检索缓存表数据

卡桑德拉表:

create table test(key int primary key, city text, location text, subscribers int);
java对象:

public class Test {

    @QuerySqlField(orderedGroups = { @QuerySqlField.Group(name = "city_subscriber_location", order = 0) })
    String city;
    @QuerySqlField(orderedGroups = {
            @QuerySqlField.Group(name = "city_subscriber_location", order = 1, descending = true) })
    int subscribers;
    @QuerySqlField(orderedGroups = { @QuerySqlField.Group(name = "city_subscriber_location", order = 2) })
    String location;
}
xml文件:

<persistence keyspace="ignite" table="test" ttl="86400">
    <keyspaceOptions>
        REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1}
        AND DURABLE_WRITES = true
    </keyspaceOptions>
    <tableOption>
        comment = 'Cache test'
        AND read_repair_chance = 0.2
    </tableOption>
    <keyPersistence class="java.lang.Integer" strategy="PRIMITIVE" column="key"/>
    <valuePersistence class="com.cache.business.model.Test" strategy="POJO"/>
</persistence>

我没有得到排序格式的输出。请帮我解决这个问题。

我们不应该使用ignite repository的findAll方法

使用下面的方法进行查询

@Query("SELECT subscribers FROM test where city = ?")
    List<Integer> selectAll(String city);
@Query(“从测试中选择订阅服务器,其中城市=?”)
列出selectAll(字符串城市);
[
  {
    "city": "mumbai",
    "subscribers": 986,
    "location": "marthalli"
  },
  {
    "city": "mumbai",
    "subscribers": 427,
    "location": "centra"
  },
  {
    "city": "mumbai",
    "subscribers": 739,
    "location": "krmarket"
  },
  {
    "city": "hyd",
    "subscribers": 637,
    "location": "krmarket"
  },
  {
    "city": "bgr",
    "subscribers": 575,
    "location": "krpuram"
  }
@Query("SELECT subscribers FROM test where city = ?")
    List<Integer> selectAll(String city);