I’m developing for a microservice application. There are several different microservices but all of them use the same database. I’ve been presented with a user story that requires querying data saved by one microservice (A) and enriching it from another microservice (B). As I understand it, in a true microservices architecture this should be done by making an API call from B to A using something like a RestTemplate or HttpClient. But seeing as the tables that contain the information I need are accessible to B from the database, is it a better design decision to simply write a DAO that gets the data I need?
Several microservices using the same database is an antipattern.
Also I don't see how you see using a DAO as an alternative to calling the other microservice. Those two are at different levels of abstraction. That's like asking whether you should buy a car with manual transmission or a rack and pinion.