I'm trying to query the Database with a list of Id's and, in case they don't exist, do some stuff with them.
My plan was to do something like
List<Optional<MyObject>> fingById(Set<String> myIds);
I understand this wont' work out of the box because I suppose that even if all the id's where present nothing guarantees me that they will be ordered, so if some of them are present I will get some random null optionals around which I won't be able to may to the Id that returned it.
Basically what I need to do in the end is to retrieve these objects, update one field or create them with default value if not present.
Which is the best way of doing this in batch?
Thanks :)