实体@Builder@Getter @Setter@ToString(doNotUseGetters = true)@EqualsAndHashCode(doNotUseGetters = true)@Table(value = "entity")public class Entity implements Serializable { @PrimaryKeyColumn(name = "id", ordinal = 0, type = PrimaryKeyType.PARTITIONED) @CassandraType(type = DataType.Name.UUID) private UUID Id; @Column("list_name") @CassandraType(type = DataType.Name.TEXT) private String name; @Column("type") @CassandraType(type = DataType.Name.TINYINT) private Byte type;实体回购@Repositorypublic interface EntityRepo extends BaseRepo<Entity, UUID> { @Query("SELECT * FROM entity WHERE id IN (:id)") Collection<ListEntity> findByIds(@Param("id") Collection<UUID> listIds); @Query("SELECT * FROM entity WHERE list_id = :id") ListEntity findById(@Param("id") UUID id);} 询问listRepo.findByListId(UUIDs.random())listRepo.findByListIds(Arrays.asList(UUIDs.random())两者都导致CassandraInvalidQueryException/InvalidQueryExceptionorg.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [SELECT * FROM lists WHERE list_id IN (?)]; UUID should be 16 or 0 bytes (20); nested exception is com.datastax.driver.core.exceptions.`InvalidQueryException: UUID should be 16 or 0 bytes (20)这里缺少什么吗?有人可以帮忙吗?
3 回答
Cats萌萌
TA贡献1805条经验 获得超9个赞
运行Spark应用程序时出现相同的错误。
执行Cassandra查询时出现错误,并且在预期为UUID类型的地方,该查询发送了一些其他数据类型。就我而言,它是一个字符串。传递正确的数据类型(UUID代替String)解决了该问题。
添加回答
举报
0/150
提交
取消