Separation of concerns
is the word that you should think before falling in love with this approach. In general practice business logic and dao logic should be kept separate as in case if in future you decide to change your database you need not go through every class searching for change the way to access new database but in DAO layer approach you need to change only your DAO layer as business layer remains intact.
why even bother with DAO layer
Вопрос
Currently i'm part of a project (spring
with JPA
) that has the following layering:
- service layer (checks for authorization and delegates actions to the manager layer)
- manager layer - does lots of buisiness logic
and then calls:
entityManager.save(object)
As you can see there is no DAO
layer in this project and as a DAO
layer fanatic i'm starting to fall in love with this setup instead.
what are the pros \ cons of this setup?
Should we bother with dao?
Решение
Не связан с StackOverflow