Spring data cassandra-无法为WriteOptions的属性[retryPolicy]解析数据类型

问题描述 投票:0回答:1

Spring引导版本2.1.9.RELEASE并为spring-boot-starter-data-cassandra]使用依赖项]

对于以下代码段

WriteOptions ttlOption = WriteOptions.builder().ttl(5).build();
CassandraBatchOperations batchOperations = cassandraTemplate.batchOps();
batchOperations.insert(myEntityClass, ttlOption);

我们目前收到以下异常

Caused by: org.springframework.data.mapping.MappingException: Cannot resolve DataType for property [retryPolicy] in entity [org.springframework.data.cassandra.core.cql.WriteOptions]; Consider adding @CassandraType.
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataTypeWithUserTypeFactory(CassandraMappingContext.java:612)
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataType(CassandraMappingContext.java:556)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getPropertyTargetType(MappingCassandraConverter.java:710)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.lambda$getTargetType$3(MappingCassandraConverter.java:700)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getTargetType(MappingCassandraConverter.java:688)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:731)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeInsertFromWrapper(MappingCassandraConverter.java:420)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:363)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:347)
at org.springframework.data.cassandra.core.QueryUtils.createInsertQuery(QueryUtils.java:107)
at org.springframework.data.cassandra.core.CassandraBatchTemplate.insert(CassandraBatchTemplate.java:121)
at org.springframework.data.cassandra.core.CassandraBatchTemplate.insert(CassandraBatchTemplate.java:100)
at org.springframework.data.cassandra.core.CassandraBatchTemplate.insert(CassandraBatchTemplate.java:92)

我想念什么?

Spring boot版本2.1.9.RELEASE并使用spring-boot-starter-data-cassandra的依赖关系对于以下代码段,WriteOptions ttlOption = WriteOptions.builder()。ttl(5).build(); ...

spring spring-boot cassandra spring-data-cassandra
1个回答
1
投票

找到答案。

© www.soinside.com 2019 - 2024. All rights reserved.