Я написал собственный запрос на сохранение, чтобы я мог добавить настраиваемый TTL для каждого элемента. Вот мой репо:
@Repository
public interface MyCassandraRepository extends
TypedIdCassandraRepository<MyCassandraItem, UUID> {
@Query("insert into " + TABLE_NAME + " (" + CQL_UUID + ", " + CQL_PLAN + ") values (?0, ?1) using ttl ?2")
MyCassandraItem customSaveWithTtl(UUID uuid, String plan, Integer ttl);
}
Вот мой стол:
CREATE TABLE IF NOT EXISTS my_users.plans (
user_id uuid,
plan text,
PRIMARY KEY (user_id)
) ;
Однако, когда я пытаюсь добавить запись, в которой строка плана содержит полный стоп / период (например, eyJhbGciOiJIUzUxMiJ9.hsdyu7832uwhjjdsjkdsew2389dhj
), я получаю следующую ошибку:
org.springframework.cassandra.support.exception.CassandraQuerySyntaxException: line 1:110 mismatched input 'eyJhbGciOiJIUzUxMiJ9' expecting ')' (...plan) values ('c7a8fd65-8ef5-420e-b02e-898fe248bbf3', ''[eyJhbGciOiJIUzUxMiJ9]....); nested exception is com.datastax.driver.core.exceptions.SyntaxError: line 1:110 mismatched input 'eyJhbGciOiJIUzUxMiJ9' expecting ')' (...plan) values ('c7a8fd65-8ef5-420e-b02e-898fe248bbf3', ''[eyJhbGciOiJIUzUxMiJ9]....)
При попытке добавить его вручную с помощью CQLSH я также получаю сообщение об ошибке с '.':
SyntaxException: line 1:826 no viable alternative at input '.' (... "plan") VALUES (c7a8fd65-8ef5-420e-b02e-898fe248bbf3, [eyJhbGciOiJIUzUxMiJ9].hsdyu7832uwhjjdsjkdse...)
Может кто-нибудь увидеть, как я могу заставить его добавить всю строку, а не просто остановиться на «.»?