I have a POJO, like this one
class foo
{
private String id;
private String attribute;
private Map<String, String> dataMap;
}
And my data model
Table Item
- INT id
- CHAR attribute
// save dataMap as a key-value pair
Table Data
- INT id
- CHAR key
- CHAR value
Now I want to combine below 2 queries
1st request:
@Select("select * from Item where attribute=#{attribute}"
public List<Item> getItemList(@Param("attribute") String attribute);
another request to get all key-value pairs for a given id
How to get one request that sets the attribute, retrieves the id list and populates the nested object (dataMap)
// walked through @Results, @Result ..
source
share