I have a working query:
SELECT p.user.id, p.id FROM Photo p WHERE p.user.id IN ?1 GROUP BY p.user.id, p.id
This returns data like
2, 656
2, 767
2, 788
6, 986
6, 1364
etc...
But it want it like this:
2; 656,767,788
6; 986,1364...
So for each user, the p.user.id, and then the list of p.id. Preferably in formatted string, comma separated, as it will be sent as json.