'mybatis - duplicated values disappear

I'm using Mybatis and started using resultMap to make the result of SQL.

Original result: {areaCode"01", areaName:"NY", data: 100.0}, {areaCode"01", areaName:"NY", data: 110.0}, {areaCode"01", areaName:"NY", data: 100.0}

the result I want: {areaCode:"01", areaName:"NY", dataList: [100.0,110.0,100.0] }

resultMap I made:

<resultMap id="resultMapId" type="java.util.HashMap">
  <id column="areaCode" property="areaCode">
  <result column="areaName" property"areaName">
  <collection property="dataList" javaType="ArrayList" ofType="double">
    <result column="data(I want this not to disappear due to the duplication) property="data">
  </collcetion>
</resultMap>

the data could be duplicated. but it's gone when is duplicated.. like this {areaCode:"01", areaName:"NY", dataList: [100.0,110.0] }

There is a way to keep the data?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source