We are developing a web application following Domain-Driven Design and layered software architecture, with the following layers:
- presentation (REST API)
- domain (entities, value objects as defined in DDD with domain-specific behavior)
- data access (DAO classess accessing the database)
Each of the above is a separate maven module, with a downward dependency, i.d. presentation depends on domain and domain on data access.
Should the data access layer return instances of the domain classes or should there be an isolation between the domain and data access layer?