Searching and reading information about the main differences of a DAO and a Repository a DAO is based on a table in the database and a Repository returns something that in higher layers is understood (bussiness object) according to this post: link
Now, suppose we have an Object that inside has 4 objects more each of different tables, would it be valid for a repository to call 4 damage to compose an object like that ?, I do not think that the 4 damages are sent to call the service layer to compose a complex object, all this is born from that I have seen in many books the 3 typical layers of an application:
Controller - > Service - > Repository or Controller - > Service - > DAO
In itself it is only a big doubt if a repository can call damage to compose a more complex object.
An example of a method in the repository would be like this:
public Cliente obtenerCliente(int idCliente){
InformacionCliente informacionCliente =
daoInformacionCliente.obtenerDatosCliente(idCliente);
Cuenta cuenta = daoCuenta.obtenerCuenta(idCliente);
HistoricoCliente historico = daoHistoricoCliente.obtenerHistorialCliente(idCliente);
Cliente cliente = new Cliente();
c.setInformacionCliente(informacionCliente);
c.setCuenta(cuenta);
c.setHistorial(historico);
return cliente;
}
I do not know much about architectures, I'm currently reading several DDD books, guided by the domain design, but far from clarifying some things, I get more doubts, in advance thank you very much.