[英]Incompatible types: java.lang.Class<capture#1 of ?> cannot be converted to
[英]Fix SQL error incompatible types: capture#1 of ? cannot be converted to int
我有一個 SQL 查詢來查詢 Ignite 緩存數據庫。 但是 select count(column_Name) 給出了以下編譯錯誤。 incompatible types: capture#1 of? cannot be converted to int
這是我的代碼。
private static final String sql = "Select count(_val) from Annotations where orderId = ? and timestamp <= ? and timestamp >= ? ";
SqlFieldsQuery sqlQ = new SqlFieldsQuery(sql).setArgs(id, t1, t2);
int count = 0;
try (QueryCursor<List<?>> cursor = cache.query(sqlQ)) {
for (List<?> row : cursor) {
count = (int) row.get(0);
}
而不是 for 循環,我嘗試了count = (int) cursor.getAll().get(0).get(0);
但這也沒有用。 任何人都知道這里發生了什么。 謝謝你。
你試過更換?
與實際類型?
try (QueryCursor<List<Integer>> cursor = cache.query(sqlQ)) {
for (List<Integer> row : cursor)
count = row.get(0);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.