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(); ...
找到答案。