Reputation: 1
I'm new in dev web so if I make mistake, pardon me!. I have a Category DTO 1-n relate with Category Item DTO, two of them have two field ID and Name. If client call API to get all Category Item, I want to return list Category contain list of Category Item ralate by CategoryID. How can I excute that in DTO?
the JSON file return like: https://i.sstatic.net/AeJmC.jpg
Upvotes: 0
Views: 2060
Reputation: 107
Add a List of CategoryItemDTO to your Category DTO , so your Category class should get like this:
class Category{
Long uid;
String name;
List<CategoryItemDTO> categoryItems;
}
Upvotes: 1