我有下表
CREATE TABLE magazines.magazine_name (
frequency smallint,
magazine_id varchar,
magazine_name varchar,
PRIMARY KEY (magazine_id,magazine_name)
);
我应该使用allow filter annotation来执行以下存储库方法吗
@Query("SELECT * from magazine_name where magazine_id = ?0")
MagazineName findMagazineCQlQuery(String id);
因为我得到了以下选项:
org.springframework.data.cassandra.CassandraInvalidQueryException:Query;
CQL[com.datastax.oss.driver.internal.core.cql.DefaultSimpleStatement@c78c2039];
Cannot execute this query as it might involve data filtering and thus may have unpredictable performance.
If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING;
nested exception is
com.datastax.oss.driver.api.core.servererrors.InvalidQueryException:
Cannot execute this query as it might involve data filtering
and thus may have unpredictable performance.
If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
顺便说一句,我知道我可以使用查询方法,甚至findbyid方法,但实际上我只是在试验cql要求并尝试了解它。
--更新域对象
@Table(value = "magazine_name")
@Data
@Builder
public class MagazineName {
@PrimaryKeyColumn(name = "magazine_id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
private String magazineId;
@PrimaryKeyColumn(name = "magazine_name", ordinal = 1, type = PrimaryKeyType.CLUSTERED)
private String name;
}
1条答案
按热度按时间gudnpqoy1#
我定义的表和你的完全一样,这是我的存储库。我可以无误地查询。
1我的存储库
2应用
三。杂志班