I have this method
@Override
public Smev3Request findRequestData(RequestFilter filter, boolean isConsumer) {
Specification<Smev3Request> spec = buildSpec(filter, isConsumer);
Optional<Smev3Request> req = smev3RequestRepo.findOne(spec);
return req.orElse(null);
}
When I use findOne I get this in req variable
in this case there are only 2 entries in response object, but the DB contains 4 records.
At the same time, when I use findAll method instead of findOne I get this result
As you can see, now there are 4 entries which is correct. What’s the reason of this behaviour and how to force findOne to return the correct number of records.
Response is the foreign table which has Lazy One To Many connection to Request table