0

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.

user2000189
  • 479
  • 4
  • 6
  • 22
  • This mapping is not possible with annotations right now. You need to declare `` with `` in a XML mapper. – ave Mar 25 '20 at 11:08
  • can we do it – user2000189 Mar 25 '20 at 11:19
  • `` is valid only in statement annotations (i.e. `@Select`, `@Insert`, etc.). You may need XML for this. – ave Mar 25 '20 at 16:02

0 Answers0