0
我有取在MyBatis的結果轉換成地圖<整數,列表<Integer>>
id | dependencies
----+--------------
1 | {1,2,3,4,5}
2 | {2,3,4,5}
3 | {3,4,5}
4 | {4,5}
5 | {5}
(5 rows)
形式的結果的循環查詢我需要這個數據映射到
HashMap<Integer, List<Integer>>,
where
column "id" becomes KEY
column "dependencies" becomes VALUE
(dependencies= postgres array obtained after array_agg)
Apparantly用,的resultSet映射爲
@Results(value={
@Result(column="id", property="key", javaType=Integer.class),
@Result(column="dependencies", property="value", typeHandler=ArrayTypeHandler.class)
})
Im getting the results with return type as
List<Map<Integer, List<Integer>>>, but they are not as expected
有沒有一種方法,我可以將結果直接映射到地圖中?
只是返回Map在您的方法映射也許是正確的,發生了什麼?你可以添加更多的信息,因爲你得到的結果或類似的東西 –
Pau