I have a POJO of type:
POJO {
int id;
int name;
List<Date> Dates;
}
Now my POJO is broken into two tables x and y, where y have dates and x have name, which are joined over the id as below:
select * from x
join y on x.id = y.id
Further now I want to select from mybatis mapper and map it to the given pojo. I am getting issue in mapping the Dates.
<resultMap id="pojo" type="Pojo">
<result property="id" column="id" javaType="Integer"/>
<result property="name" column="name" javaType="String"/>
<result property="Dates" column="date" javaType="ArrayList" typeHandler="org.apache.ibatis.type.DateTypeHandler"/>
</resultMap>
I tried using collection but I don't have any property within the Dates. How to populate the dates field ?
<collection property="Dates" ofType="java.util.Date">
<result column="date" />
</collection>
This worked