【发布时间】:2021-12-15 02:45:24
【问题描述】:
我想在我的 java CassandraRepository 中使用 @Query 注释来执行此操作:
select * from TABLE_A where month IN
('2021-01',
'2021-02',
'2021-03',
'2021-04',
'2021-05',
'2021-06',
'2021-07',
'2021-08',
'2021-09',
'2021-10',
'2021-11',
'2021-12')
AND user_id = '1';
在我的 CassandraRepository 中:
@Query("SELECT * FROM TABLE_A WHERE user_id = ?0 AND month IN ?1")
List<UserListenCountByMonth> findByUserIdAndYear(String userId, List<String> year);
但它得到错误:
原因:com.datastax.driver.core.exceptions.SyntaxError: line 1:84 输入时没有可行的替代方案 '2021-01'(...WHERE user_id = '1' AND [month] IN...)
我检查了调试,我的字符串列表没有问题。我错过了什么?谢谢。
【问题讨论】: