I'm using Derby embedded database and javax.json. To my knowledge I can't concatenate a result with derby. i.e:
ID | NAME | ROLE
----------------
1  | me   | admin, user
3  | root | root, user
I need to go from normalised database data to a Json document. I can't see how to do this other than to use an intermediate map and a two step SQL query. Links to how others have achieved this would be a brilliant help.
ID | NAME | ROLE
----------------
1  | me   | admin
1  | me   | user
3  | root | user
3  | root | root
{
   users : [
      {
          "user_id":1,
          "user_name":"me",
          "roles":[
              "admin",
               "user"
           ]
       },
       ...ect.
    ]
}
A user needs to be able to have multiple roles as I am using realms.
 
    