I am developing a web application using a tiered architecture. I have:
- Application level (controllers)
- Service Level
- Data Access Level (DAO)
which connects to the Oracle database.
I am using JPA with Hibernate as an implementation. Therefore, I create entities to model the representation of objects in my relational database tables.
My question is ... Is it a bad practice to use these objects objects in all three of my layers?
I know that it should be used according to the level of access to data, at least, but what is further than at the level of service and application?
I saw that some people use DTOs in the service and application layers, and they convert between DTOs and objects between the Service and Data Access layers.
Just wondering what is best for this and what should be the best approach?
source
share