【发布时间】:2021-09-18 18:07:41
【问题描述】:
我正在尝试在 Java Springboot 中将 @Query 参数用于 Cassandra 存储库。
但它不起作用。下面是示例代码。
@Repository
public interface Table1Repository extends CassandraRepository<Table1,TransactionKey>{
@Query("SELECT * FROM table1 WHERE code=?0 and product=?1 and id=?2 order by transactiontime DESC limit ?3")
List<Table1> searchTransactionLimit(String code,String product,Double id, int limit);
}
如果我在@Query 中硬编码 id 的值,那么它就可以工作了。 例如,
@Query("SELECT * FROM table1 WHERE code=?0 and product=?1 and id=17.0 order by transactiontime DESC limit ?3")
所以基本上,类型 String 和 int 在 @Query 中工作。但是 Double 类型不起作用。
【问题讨论】:
标签: spring spring-boot cassandra spring-data-jpa