I have a City
aggregate, having a list of PointOfInterest
entities. This latter entity lies logically inside the City aggregate for reasons that won't be explained here. No entity holds a link to PointOfInterest, apart from the aggregate root, City.
However, we have a web page for PointOfInterest, browsable from the City page, that (mainly for SEO reasons) only has the PointOfInterest id
in its URL.
Thus, from the controller, it would be handy to query the CityRepository for a PointOfInterest directly, such as CityRepository.findPointOfInterestById()
.
The other option would be to query CityRepository.findCityByPointOfInterestId()
, then City.findPointOfInterestById()
, which looks a bit cumbersome in this case.
Is there anything wrong with the first approach?