I encountered problems when returning a list of Objects inside another Object when using MyBatis. My main object looks like this:
private Long id;
private String symbol;
private List<TypePermission> typePermissions;
and my mapper looks like this
<resultMap type="CalendarType" id="calendarTypeMap">
<result column="id" property="id"/>
<result column="symbol" property="symbol"/>
<collection property="TypePermissions" resultMap="TypePermissions"/>
</resultMap>
<resultMap id="TypePermissions" type="TypePermission">
<result property="roleId" column="roleId"/>
<result property="permissionSymbol" column="permissionSymbol"/>
</resultMap>
My goal is to get an object like this:
content:[
"id":id,
"symbol":symbol,
"TypePermissions":{
"roleId":roleId,
"permissionSymbol":permissionSymbol
}
]
When I execute the sql query I get the following an error cannot find symbol TypePermissions, because the main SELECT tries to select rows such as TYPEPERMISSIONS, ID, SYMBOL
I searched over the internet, but failed to find anything useful. Could you help me and point out what am I doing wrong?