-1
我想使用從我的數據庫中提取id列表的方法。我設法用列表的字符串這樣做,但它不會與清單的String [],這是我真的需要obtain.This工作是我的try語句:如何將數據庫訊問的結果放入列表中<String[]> - java
try {
connection = getJNDIConnection(connectionName);
pstmt = connection.prepareStatement(sqlQuery);
// set the input parameters
pstmt.setLong(1, groupId);
resultSet = pstmt.executeQuery();
if (resultSet.next()) {
result = new ArrayList<String[]>();
do {
Array resultStr = resultSet.getArray(1);
result.addAll(resultStr);//here is the problem
if (Constants.DEBUG_MODE.equals("true")) {
logger.debug("[{}] Get the customers list id from database GROUPS_CUSTOMERS table={}", methodName, result);
}
} while(resultSet.next());
}
}
Eclipse是給我回個消息:「方法addAll(Collection)在類型List中不適用於參數(Array)「。 我可以嘗試別的嗎? 非常感謝。
謝謝,請您儘量幫忙嗎? –