I'm having difficulties generate an object to provide me data based on two tables.
Table One
public class User {
private String name;
//...
}
Table Two
public class Profile {
@JoinColumn(name = "user_id")
private User user;
}
Objective
I need an object to give me the name and number of per user profiles.
Something like (in JSON):
[
{"name":"John", "profiles":1 },
{"name":"Maria", "profiles":5 },
{"name":"Victor", "profiles":3 }
]
The best solution to do this?