Ibatis map List<T> into @Result

437 Views Asked by At

I have a situation like, i write query in Mapper java class (Ibatis) to fetch List values. Inside this ParentPojo i have List along with that some other fields like num, name.

ChildPojo contains field as a1,a2,a3.

Sample ParentPojo:

private String num;
private String name;
private List<ChildPojo> childPojo = new ArrayList<>();

Now i write a query to return list of values and trying to map like the below, but the below does not work

@Results( value = {
@Result(property= "num" , column = "numColumn"),
@Result(property = "name", column= "name",
@Result(property = "childPojo[0].a1", column ="a1"),
@Result(property = "childPojo[0].a2", column ="a2"),
@Result(property = "childPojo[0].a3", column ="a3")
})

When i do this i get indexOutOfBound error.

0

There are 0 best solutions below